1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
3 * Time utility functions
6 * Damon Chaplin (damon@ximian.com)
8 * (C) 2001 Ximian, Inc.
11 #if !defined (__LIBEDATASERVER_H_INSIDE__) && !defined (LIBEDATASERVER_COMPILATION)
12 #error "Only <libedataserver/libedataserver.h> should be included directly."
15 #ifndef E_TIME_UTILS_H
16 #define E_TIME_UTILS_H
25 * @E_TIME_PARSE_OK: The time string was parsed successfully.
26 * @E_TIME_PARSE_NONE: The time string was empty.
27 * @E_TIME_PARSE_INVALID: The time string was not formatted correctly.
35 /* Tries to parse a string containing a date and time. */
37 e_time_parse_date_and_time (const gchar *value,
40 /* Tries to parse a string containing a date. */
42 e_time_parse_date (const gchar *value,
45 /* Same behavior as the functions above with two_digit_year set to NULL. */
47 e_time_parse_date_and_time_ex (const gchar *value,
49 gboolean *two_digit_year);
51 e_time_parse_date_ex (const gchar *value,
53 gboolean *two_digit_year);
55 /* Tries to parse a string containing a time. */
57 e_time_parse_time (const gchar *value,
60 /* Turns a struct tm into a string like "Wed 3/12/00 12:00:00 AM". */
61 void e_time_format_date_and_time (struct tm *date_tm,
62 gboolean use_24_hour_format,
63 gboolean show_midnight,
64 gboolean show_zero_seconds,
68 /* Formats a time from a struct tm, e.g. "01:59 PM". */
69 void e_time_format_time (struct tm *date_tm,
70 gboolean use_24_hour_format,
71 gboolean show_zero_seconds,
75 /* Like mktime(3), but assumes UTC instead of local timezone. */
76 time_t e_mktime_utc (struct tm *tm);
78 /* Like localtime_r(3), but also returns an offset in minutes after UTC.
79 * (Calling gmtime with tt + offset would generate the same tm) */
80 void e_localtime_with_offset (time_t tt,
84 /* Returns format like %x, but always exchange all 'y' to 'Y'
85 * (force 4 digit year in format).
86 * Caller is responsible to g_free returned pointer. */
87 gchar * e_time_get_d_fmt_with_4digit_year
92 #endif /* E_TIME_UTILS_H */