time_utils.h

Go to the documentation of this file.
00001 #ifndef __TIME_UTILS_H__
00002 #define __TIME_UTILS_H__
00003 
00004 /*
00005  * This file is part of liberutils.
00006  *
00007  * liberutils is free software: you can redistribute it and/or modify
00008  * it under the terms of the GNU General Public License as published by
00009  * the Free Software Foundation, either version 2 of the License, or
00010  * (at your option) any later version.
00011  *
00012  * liberutils is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00015  * GNU General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU General Public License
00018  * along with this program. If not, see <http://www.gnu.org/licenses/>.
00019  */
00020 
00021 /**
00022  * Copyright (C) 2009 iRex Technologies B.V.
00023  * All rights reserved.
00024  */
00025  
00026 //----------------------------------------------------------------------------
00027 // Include Files
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
Generated by  doxygen 1.6.2-20100208