Commit 912224f8 912224f8b9fd7638fd48b86670fffca693c2bf9f by Sergey Poznyakoff

Rename mu_tm2time to mu_datetime_to_utc.

1 parent 7efa4777
......@@ -379,7 +379,7 @@ util_parse_internal_date (char *date, time_t *timep,
adjust_tm (&tm, &tz, flag);
time = mu_tm2time (&tm, &tz);
time = mu_datetime_to_utc (&tm, &tz);
if (time == (time_t) - 1)
return 2;
......@@ -398,7 +398,7 @@ util_parse_822_date (const char *date, time_t *timep,
if (mu_parse822_date_time (&p, date + strlen (date), &tm, &tz) == 0)
{
adjust_tm (&tm, &tz, flag);
*timep = mu_tm2time (&tm, &tz);
*timep = mu_datetime_to_utc (&tm, &tz);
return 0;
}
return 1;
......@@ -414,7 +414,7 @@ util_parse_ctime_date (const char *date, time_t *timep,
if (mu_scan_datetime (date, MU_DATETIME_FROM, &tm, &tz, NULL) == 0)
{
adjust_tm (&tm, &tz, flag);
*timep = mu_tm2time (&tm, &tz);
*timep = mu_datetime_to_utc (&tm, &tz);
return 0;
}
return 1;
......
......@@ -59,7 +59,7 @@ struct mu_timezone
int mu_parse_date (const char *p, time_t *rettime, const time_t *now);
time_t mu_utc_offset (void);
time_t mu_tm2time (struct tm *timeptr, struct mu_timezone *tz);
time_t mu_datetime_to_utc (struct tm *timeptr, struct mu_timezone *tz);
size_t mu_strftime (char *s, size_t max, const char *format, struct tm *tm);
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,
case 's':
/* The number of seconds since the Epoch */
rc = mu_stream_printf (str, "%lu",
(unsigned long) mu_tm2time (&tm, tz));
(unsigned long) mu_datetime_to_utc (&tm, tz));
break;
case 'S':
......
......@@ -25,10 +25,9 @@
#define JD_OF_EPOCH 2440588
/* Convert struct tm into time_t, taking into account timezone offset. */
/* FIXME: Ignores DST */
/* Convert struct tm into UTC. */
time_t
mu_tm2time (struct tm *tm, struct mu_timezone *tz)
mu_datetime_to_utc (struct tm *tm, struct mu_timezone *tz)
{
int jd = mu_datetime_julianday (tm->tm_year + 1900, tm->tm_mon + 1,
tm->tm_mday);
......
......@@ -202,7 +202,7 @@ mime_create_ds (mu_mime_t mime, mu_message_t orig)
mu_message_get_envelope (orig, &env);
if (mu_envelope_sget_date (env, &p) == 0
&& mu_scan_datetime (p, MU_DATETIME_FROM, &tm, &tz, NULL) == 0)
t = mu_tm2time (&tm, &tz);
t = mu_datetime_to_utc (&tm, &tz);
else
/* Use local time instead */
t = time (NULL);
......
......@@ -1530,7 +1530,7 @@ imap_envelope_date (mu_envelope_t envelope, char *buffer, size_t buflen,
if (mu_parse_imap_date_time(datep, &tm, &tz) != 0)
now = (time_t)-1;
else
now = mu_tm2time (&tm, &tz);
now = mu_datetime_to_utc (&tm, &tz);
/* if the time was unparseable, or mktime() didn't like what we
parsed, use the calendar time. */
......
......@@ -1458,7 +1458,7 @@ builtin_clock (struct mh_machine *mach)
if (_parse_date (mach, &tm, &tz))
return;
mach->arg_num = mu_tm2time (&tm, &tz);
mach->arg_num = mu_datetime_to_utc (&tm, &tz);
}
/* rclock date integer seconds prior to current time*/
......@@ -1471,7 +1471,7 @@ builtin_rclock (struct mh_machine *mach)
if (_parse_date (mach, &tm, &tz))
return;
mach->arg_num = now - mu_tm2time (&tm, &tz);
mach->arg_num = now - mu_datetime_to_utc (&tm, &tz);
}
struct
......
......@@ -341,7 +341,7 @@ _parse_822_date (char *date, time_t * timep)
if (mu_parse822_date_time (&p, date + strlen (date), &tm, &tz) == 0)
{
*timep = mu_tm2time (&tm, &tz);
*timep = mu_datetime_to_utc (&tm, &tz);
return 0;
}
return 1;
......