Rename mu_tm2time to mu_datetime_to_utc.
Showing
8 changed files
with
12 additions
and
13 deletions
... | @@ -379,7 +379,7 @@ util_parse_internal_date (char *date, time_t *timep, | ... | @@ -379,7 +379,7 @@ util_parse_internal_date (char *date, time_t *timep, |
379 | 379 | ||
380 | adjust_tm (&tm, &tz, flag); | 380 | adjust_tm (&tm, &tz, flag); |
381 | 381 | ||
382 | time = mu_tm2time (&tm, &tz); | 382 | time = mu_datetime_to_utc (&tm, &tz); |
383 | if (time == (time_t) - 1) | 383 | if (time == (time_t) - 1) |
384 | return 2; | 384 | return 2; |
385 | 385 | ||
... | @@ -398,7 +398,7 @@ util_parse_822_date (const char *date, time_t *timep, | ... | @@ -398,7 +398,7 @@ util_parse_822_date (const char *date, time_t *timep, |
398 | if (mu_parse822_date_time (&p, date + strlen (date), &tm, &tz) == 0) | 398 | if (mu_parse822_date_time (&p, date + strlen (date), &tm, &tz) == 0) |
399 | { | 399 | { |
400 | adjust_tm (&tm, &tz, flag); | 400 | adjust_tm (&tm, &tz, flag); |
401 | *timep = mu_tm2time (&tm, &tz); | 401 | *timep = mu_datetime_to_utc (&tm, &tz); |
402 | return 0; | 402 | return 0; |
403 | } | 403 | } |
404 | return 1; | 404 | return 1; |
... | @@ -414,7 +414,7 @@ util_parse_ctime_date (const char *date, time_t *timep, | ... | @@ -414,7 +414,7 @@ util_parse_ctime_date (const char *date, time_t *timep, |
414 | if (mu_scan_datetime (date, MU_DATETIME_FROM, &tm, &tz, NULL) == 0) | 414 | if (mu_scan_datetime (date, MU_DATETIME_FROM, &tm, &tz, NULL) == 0) |
415 | { | 415 | { |
416 | adjust_tm (&tm, &tz, flag); | 416 | adjust_tm (&tm, &tz, flag); |
417 | *timep = mu_tm2time (&tm, &tz); | 417 | *timep = mu_datetime_to_utc (&tm, &tz); |
418 | return 0; | 418 | return 0; |
419 | } | 419 | } |
420 | return 1; | 420 | return 1; | ... | ... |
... | @@ -59,7 +59,7 @@ struct mu_timezone | ... | @@ -59,7 +59,7 @@ struct mu_timezone |
59 | int mu_parse_date (const char *p, time_t *rettime, const time_t *now); | 59 | int mu_parse_date (const char *p, time_t *rettime, const time_t *now); |
60 | 60 | ||
61 | time_t mu_utc_offset (void); | 61 | time_t mu_utc_offset (void); |
62 | time_t mu_tm2time (struct tm *timeptr, struct mu_timezone *tz); | 62 | time_t mu_datetime_to_utc (struct tm *timeptr, struct mu_timezone *tz); |
63 | size_t mu_strftime (char *s, size_t max, const char *format, struct tm *tm); | 63 | size_t mu_strftime (char *s, size_t max, const char *format, struct tm *tm); |
64 | 64 | ||
65 | int mu_c_streamftime (mu_stream_t str, const char *fmt, struct tm *tm, | 65 | int mu_c_streamftime (mu_stream_t str, const char *fmt, struct tm *tm, | ... | ... |
... | @@ -298,7 +298,7 @@ mu_c_streamftime (mu_stream_t str, const char *fmt, struct tm *input_tm, | ... | @@ -298,7 +298,7 @@ mu_c_streamftime (mu_stream_t str, const char *fmt, struct tm *input_tm, |
298 | case 's': | 298 | case 's': |
299 | /* The number of seconds since the Epoch */ | 299 | /* The number of seconds since the Epoch */ |
300 | rc = mu_stream_printf (str, "%lu", | 300 | rc = mu_stream_printf (str, "%lu", |
301 | (unsigned long) mu_tm2time (&tm, tz)); | 301 | (unsigned long) mu_datetime_to_utc (&tm, tz)); |
302 | break; | 302 | break; |
303 | 303 | ||
304 | case 'S': | 304 | case 'S': | ... | ... |
... | @@ -25,10 +25,9 @@ | ... | @@ -25,10 +25,9 @@ |
25 | 25 | ||
26 | #define JD_OF_EPOCH 2440588 | 26 | #define JD_OF_EPOCH 2440588 |
27 | 27 | ||
28 | /* Convert struct tm into time_t, taking into account timezone offset. */ | 28 | /* Convert struct tm into UTC. */ |
29 | /* FIXME: Ignores DST */ | ||
30 | time_t | 29 | time_t |
31 | mu_tm2time (struct tm *tm, struct mu_timezone *tz) | 30 | mu_datetime_to_utc (struct tm *tm, struct mu_timezone *tz) |
32 | { | 31 | { |
33 | int jd = mu_datetime_julianday (tm->tm_year + 1900, tm->tm_mon + 1, | 32 | int jd = mu_datetime_julianday (tm->tm_year + 1900, tm->tm_mon + 1, |
34 | tm->tm_mday); | 33 | tm->tm_mday); | ... | ... |
... | @@ -202,7 +202,7 @@ mime_create_ds (mu_mime_t mime, mu_message_t orig) | ... | @@ -202,7 +202,7 @@ mime_create_ds (mu_mime_t mime, mu_message_t orig) |
202 | mu_message_get_envelope (orig, &env); | 202 | mu_message_get_envelope (orig, &env); |
203 | if (mu_envelope_sget_date (env, &p) == 0 | 203 | if (mu_envelope_sget_date (env, &p) == 0 |
204 | && mu_scan_datetime (p, MU_DATETIME_FROM, &tm, &tz, NULL) == 0) | 204 | && mu_scan_datetime (p, MU_DATETIME_FROM, &tm, &tz, NULL) == 0) |
205 | t = mu_tm2time (&tm, &tz); | 205 | t = mu_datetime_to_utc (&tm, &tz); |
206 | else | 206 | else |
207 | /* Use local time instead */ | 207 | /* Use local time instead */ |
208 | t = time (NULL); | 208 | t = time (NULL); | ... | ... |
... | @@ -1530,7 +1530,7 @@ imap_envelope_date (mu_envelope_t envelope, char *buffer, size_t buflen, | ... | @@ -1530,7 +1530,7 @@ imap_envelope_date (mu_envelope_t envelope, char *buffer, size_t buflen, |
1530 | if (mu_parse_imap_date_time(datep, &tm, &tz) != 0) | 1530 | if (mu_parse_imap_date_time(datep, &tm, &tz) != 0) |
1531 | now = (time_t)-1; | 1531 | now = (time_t)-1; |
1532 | else | 1532 | else |
1533 | now = mu_tm2time (&tm, &tz); | 1533 | now = mu_datetime_to_utc (&tm, &tz); |
1534 | 1534 | ||
1535 | /* if the time was unparseable, or mktime() didn't like what we | 1535 | /* if the time was unparseable, or mktime() didn't like what we |
1536 | parsed, use the calendar time. */ | 1536 | parsed, use the calendar time. */ | ... | ... |
... | @@ -1458,7 +1458,7 @@ builtin_clock (struct mh_machine *mach) | ... | @@ -1458,7 +1458,7 @@ builtin_clock (struct mh_machine *mach) |
1458 | 1458 | ||
1459 | if (_parse_date (mach, &tm, &tz)) | 1459 | if (_parse_date (mach, &tm, &tz)) |
1460 | return; | 1460 | return; |
1461 | mach->arg_num = mu_tm2time (&tm, &tz); | 1461 | mach->arg_num = mu_datetime_to_utc (&tm, &tz); |
1462 | } | 1462 | } |
1463 | 1463 | ||
1464 | /* rclock date integer seconds prior to current time*/ | 1464 | /* rclock date integer seconds prior to current time*/ |
... | @@ -1471,7 +1471,7 @@ builtin_rclock (struct mh_machine *mach) | ... | @@ -1471,7 +1471,7 @@ builtin_rclock (struct mh_machine *mach) |
1471 | 1471 | ||
1472 | if (_parse_date (mach, &tm, &tz)) | 1472 | if (_parse_date (mach, &tm, &tz)) |
1473 | return; | 1473 | return; |
1474 | mach->arg_num = now - mu_tm2time (&tm, &tz); | 1474 | mach->arg_num = now - mu_datetime_to_utc (&tm, &tz); |
1475 | } | 1475 | } |
1476 | 1476 | ||
1477 | struct | 1477 | struct | ... | ... |
... | @@ -341,7 +341,7 @@ _parse_822_date (char *date, time_t * timep) | ... | @@ -341,7 +341,7 @@ _parse_822_date (char *date, time_t * timep) |
341 | 341 | ||
342 | if (mu_parse822_date_time (&p, date + strlen (date), &tm, &tz) == 0) | 342 | if (mu_parse822_date_time (&p, date + strlen (date), &tm, &tz) == 0) |
343 | { | 343 | { |
344 | *timep = mu_tm2time (&tm, &tz); | 344 | *timep = mu_datetime_to_utc (&tm, &tz); |
345 | return 0; | 345 | return 0; |
346 | } | 346 | } |
347 | return 1; | 347 | return 1; | ... | ... |
-
Please register or sign in to post a comment