[project @ 1999-09-12 16:24:46 by sof]
[ghc-hetmet.git] / ghc / lib / std / cbits / timezone.c
1 /* 
2  * (c) The GRASP/AQUA Project, Glasgow University, 1994-1998
3  *
4  * $Id: timezone.c,v 1.4 1999/09/12 14:26:32 sof Exp $
5  *
6  * Timezone Runtime Support
7  */
8
9 #include "Rts.h"
10 #include "stgio.h"
11 #include "timezone.h"
12
13 StgInt get_tm_sec   ( StgAddr x ) { return ((struct tm*)x)->tm_sec;   }
14 StgInt get_tm_min   ( StgAddr x ) { return ((struct tm*)x)->tm_min;   }
15 StgInt get_tm_hour  ( StgAddr x ) { return ((struct tm*)x)->tm_hour;  }
16 StgInt get_tm_mday  ( StgAddr x ) { return ((struct tm*)x)->tm_mday;  }
17 StgInt get_tm_mon   ( StgAddr x ) { return ((struct tm*)x)->tm_mon;   }
18 StgInt get_tm_year  ( StgAddr x ) { return ((struct tm*)x)->tm_year;  }
19 StgInt get_tm_wday  ( StgAddr x ) { return ((struct tm*)x)->tm_wday;  }
20 StgInt get_tm_yday  ( StgAddr x ) { return ((struct tm*)x)->tm_yday;  }
21 StgInt get_tm_isdst ( StgAddr x ) { return ((struct tm*)x)->tm_isdst; }
22 StgAddr prim_ZONE    ( StgAddr x ) { return ZONE(x);   }
23 StgInt prim_GMTOFF  ( StgAddr x ) { return GMTOFF(x); }
24
25 StgInt prim_SETZONE ( StgAddr x, StgAddr y )
26 {
27   SETZONE(x,y);
28 }
29
30 StgInt sizeof_word      ( void ) { return (sizeof(unsigned int)); }
31 StgInt sizeof_struct_tm ( void ) { return (sizeof(struct tm)); }
32 StgInt sizeof_time_t    ( void ) { return (sizeof(time_t)); }
33
34 char*
35 get_ZONE (StgAddr x)
36 {
37 #ifdef cygwin32_TARGET_OS
38   /* 
39    * tzname[] isn't properly initialised under cygwin B20.1 
40    * unless tzset() is called, so better do it here.
41    */
42   tzset();
43
44 #endif
45   return (ZONE(x));
46 }