ps2sdk  1.1
A collection of Open Source libraries used for developing applications on Sony's PlayStation 2® (PS2).
timezone.c
Go to the documentation of this file.
1 /*
2 # _____ ___ ____ ___ ____
3 # ____| | ____| | | |____|
4 # | ___| |____ ___| ____| | \ PS2DEV Open Source Project.
5 #-----------------------------------------------------------------------
6 # Copyright 2001-2004, ps2dev - http://www.ps2dev.org
7 # Licenced under Academic Free License version 2.0
8 # Review ps2sdk README & LICENSE files for further details.
9 */
10 
16 #include <time.h>
17 #include <sys/_tz_structs.h>
18 #include <stdio.h>
19 #include <stdlib.h>
20 #define OSD_CONFIG_NO_LIBCDVD
21 #include "osd_config.h"
22 
23 static char _ps2sdk_tzname[15];
24 
25 __attribute__((weak))
27 {
28  // Set TZ and call tzset to ensure that timezone information won't get overwritten when tszet is called multiple times
29  setenv("TZ", "", 0);
30  tzset();
31 
32  __tzinfo_type *tz = __gettzinfo();
33 
34  // _timezone is in seconds, while the return value of configGetTimezone is in minutes
35  // Add one hour if configIsDaylightSavingEnabled is 1
36  _timezone = (configGetTimezone() + (configIsDaylightSavingEnabled() * 60)) * 60;
37  tz->__tzrule[0].offset = _timezone;
38  snprintf(_ps2sdk_tzname, sizeof(_ps2sdk_tzname), "Etc/GMT%+ld", _timezone / 3600);
39  _tzname[0] = _ps2sdk_tzname;
40  _tzname[1] = _ps2sdk_tzname;
41 
42  // Don't perform DST conversion
43  _daylight = 0;
44 }
int configGetTimezone(void)
int configIsDaylightSavingEnabled(void)
void _ps2sdk_timezone_update()
Definition: timezone.c:26
static char _ps2sdk_tzname[15]
Definition: timezone.c:23