version 1.1.1.2, 2000/01/22 14:16:02 |
version 1.1.1.3, 2003/09/15 07:09:27 |
|
|
case 'Y': |
case 'Y': |
s = read_int(s, 4, &tm->tm_year); |
s = read_int(s, 4, &tm->tm_year); |
date++; |
date++; |
/* tm->tm_year -= 1900; */ |
|
/* HOE tm->tm_year %= 100; */ |
|
break; |
break; |
|
|
case 'j': |
case 'j': |
|
|
s = read_int(s, 2, &tm->tm_sec); |
s = read_int(s, 2, &tm->tm_sec); |
break; |
break; |
|
|
|
/* read EPOCH data |
|
* EPOCH is the std. unixtimeformat seconds since 01.01.1970 UTC |
|
* actualy i would need a read_long (or what time_t is else) |
|
* aktualy this is not my idea i got if from |
|
* AlunDa Penguin Jones (21.11.97) |
|
* but changed %t to %s because of strftime |
|
* and fixed the localtime() into gmtime() |
|
* maybe we should use ggmtime() ? but who choose double ???? |
|
* Walter Harms <WHarms@bfs.de> 26 Mar 2000 |
|
*/ |
|
|
|
case 's': |
|
{ |
|
/* time_t when; */ |
|
int when; |
|
struct tm *tmwhen; |
|
s = read_int(s, 10, &when); |
|
tmwhen = gmtime((time_t*)&when); |
|
tmwhen->tm_year += 1900; |
|
*tm = *tmwhen; |
|
break; |
|
} |
|
|
default: |
default: |
int_warn("Bad time format in string", NO_CARET); |
int_warn("Bad time format in string", NO_CARET); |
} |
} |
fmt++; |
fmt++; |
} |
} |
|
|
FPRINTF((stderr, "read date-time : %d/%d/%d:%d:%d:%d\n", tm->tm_mday, tm->tm_mon + 1, tm->tm_year, tm->tm_hour, tm->tm_min, tm->tm_sec)); |
FPRINTF((stderr, "read date-time : %02d/%02d/%d:%02d:%02d:%02d\n", tm->tm_mday, tm->tm_mon + 1, tm->tm_year, tm->tm_hour, tm->tm_min, tm->tm_sec)); |
|
|
/* now check the date/time entered, normalising if necessary |
/* now check the date/time entered, normalising if necessary |
* read_int cannot read a -ve number, but can read %m=0 then decrement |
* read_int cannot read a -ve number, but can read %m=0 then decrement |
|
|
#undef M |
#undef M |
#undef H |
#undef H |
|
|
FPRINTF((stderr, "normalised time : %d/%d/%d:%d:%d:%d\n", tm->tm_mday, tm->tm_mon + 1, tm->tm_year, tm->tm_hour, tm->tm_min, tm->tm_sec)); |
FPRINTF((stderr, "normalised time : %02d/%02d/%d:%02d:%02d:%02d\n", tm->tm_mday, tm->tm_mon + 1, tm->tm_year, tm->tm_hour, tm->tm_min, tm->tm_sec)); |
|
|
if (date) { |
if (date) { |
if (yday) { |
if (yday) { |
|
|
dsec *= 60.0; |
dsec *= 60.0; |
dsec += tm->tm_sec; |
dsec += tm->tm_sec; |
|
|
FPRINTF((stderr, "broken-down time : %d/%d/%d:%d:%d:%d = %g seconds\n", tm->tm_mday, tm->tm_mon + 1, tm->tm_year, tm->tm_hour, tm->tm_min, tm->tm_sec, dsec)); |
FPRINTF((stderr, "broken-down time : %02d/%02d/%d:%02d:%02d:%02d = %g seconds\n", tm->tm_mday, tm->tm_mon + 1, tm->tm_year, tm->tm_hour, tm->tm_min, tm->tm_sec, dsec)); |
|
|
return (dsec); |
return (dsec); |
} |
} |
|
|
} |
} |
tm->tm_mday = days + 1; |
tm->tm_mday = days + 1; |
|
|
FPRINTF((stderr, "broken-down time : %d/%d/%d:%d:%d:%d\n", tm->tm_mday, tm->tm_mon + 1, tm->tm_year, tm->tm_hour, tm->tm_min, tm->tm_sec)); |
FPRINTF((stderr, "broken-down time : %02d/%02d/%d:%02d:%02d:%02d\n", tm->tm_mday, tm->tm_mon + 1, tm->tm_year, tm->tm_hour, tm->tm_min, tm->tm_sec)); |
|
|
return (0); |
return (0); |
} |
} |