00001 #ifndef __TIME_UTILS_H__
00002 #define __TIME_UTILS_H__
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030 #include <glib.h>
00031
00032 G_BEGIN_DECLS
00033
00034 #define TOTAL_TIMEZONES 33
00035 #define TZ_FILE "/home/root/.timezone"
00036
00037 typedef struct
00038 {
00039 int tzoffset;
00040 char tzname[12];
00041 char description[80];
00042 } tz_info;
00043
00044 static const tz_info timezones[TOTAL_TIMEZONES] =
00045 {
00046 {-39600, "GMT+11:00", "(GMT-11:00) Midway Island, Samoa" },
00047 {-36000, "GMT+10:00", "(GMT-10:00) Hawaii" },
00048 {-32400, "GMT+09:00", "(GMT-09:00) Alaska" },
00049 {-28800, "GMT+08:00", "(GMT-08:00) US Pacific Time" },
00050 {-25200, "GMT+07:00", "(GMT-07:00) US Mountain Time" },
00051 {-21600, "GMT+06:00", "(GMT-06:00) US Central Time" },
00052 {-18000, "GMT+05:00", "(GMT-05:00) US Eastern Time" },
00053 {-14400, "GMT+04:00", "(GMT-04:00) Atlantic Time" },
00054 {-12600, "GMT+03:30", "(GMT-03:30) Newfoundland and Labrador" },
00055 {-10800, "GMT+03:00", "(GMT-03:00) Georgetown, Greenland, Buenos Aires" },
00056 { -7200, "GMT+02:00", "(GMT-02:00) Mid-Atlantic" },
00057 { -3600, "GMT+01:00", "(GMT-01:00) Cape Verde Islands, Azores" },
00058 { 0, "GMT+00:00", "(GMT) Greenwich Mean Time, London, Lisbon" },
00059 { 3600, "GMT-01:00", "(GMT+01:00) Central European Time, Amsterdam, Paris" },
00060 { 7200, "GMT-02:00", "(GMT+02:00) Eastern European Time, Athens, Istanbul" },
00061 { 10800, "GMT-03:00", "(GMT+03:00) Moscow" },
00062 { 12600, "GMT-03:30", "(GMT+03:30) Tehran" },
00063 { 14400, "GMT-04:00", "(GMT+04:00) Abu Dhabi, Muscat" },
00064 { 16200, "GMT-04:30", "(GMT+04:30) Kabul" },
00065 { 18000, "GMT-05:00", "(GMT+05:00) Central Asia" },
00066 { 19800, "GMT-05:30", "(GMT+05:30) Indian Standard Time" },
00067 { 20700, "GMT-05:45", "(GMT+05:45) Kathmandu" },
00068 { 21600, "GMT-06:00", "(GMT+06:00) Almaty, Novosibirsk, Astana, Dhaka" },
00069 { 23400, "GMT-06:30", "(GMT+06:30) Yangon (Rangoon)" },
00070 { 25200, "GMT-07:00", "(GMT+07:00) Bangkok, Hanoi, Jakarta" },
00071 { 28800, "GMT-08:00", "(GMT+08:00) China, Australian Western Standard Time" },
00072 { 32400, "GMT-09:00", "(GMT+09:00) Japan Standard Time" },
00073 { 34200, "GMT-09:30", "(GMT+09:30) Australian Central Standard Time" },
00074 { 36000, "GMT-10:00", "(GMT+10:00) Australian Eastern Standard Time" },
00075 { 37800, "GMT-10:30", "(GMT+10:30) Lord Howe Island" },
00076 { 39600, "GMT-11:00", "(GMT+11:00) Solomon Islands, New Caledonia" },
00077 { 43200, "GMT-12:00", "(GMT+12:00) Auckland, Fiji Islands" },
00078 { 46800, "GMT-13:00", "(GMT+13:00) Nuku'alofa" }
00079 };
00080
00081
00082 gchar* get_timezone(void);
00083 gint get_timezone_index(const char* tzname, gboolean* is_dst);
00084 gboolean set_time_from_server(void);
00085 void set_time_utc(time_t utc_time);
00086 gboolean set_timezone(const char* tzname, gboolean is_dst);
00087
00088 G_END_DECLS
00089
00090 #endif