2 % (c) The GRASP/AQUA Project, Glasgow University, 1995
4 \subsection[toUTCTime.lc]{toUTCTime Runtime Support}
12 #ifdef cygwin32_TARGET_OS
18 toUTCTime(I_ size, StgByteArray d, StgByteArray res)
21 struct tm *tm,*tmp=(struct tm *)res;
30 t = - (time_t) ((StgInt *)d)[0];
35 t = (time_t) ((StgInt *)d)[0];
46 gmtime() may return a ptr to statically allocated storage,
47 so to make toUTCTime reentrant, we manually copy
48 the structure into the (struct tm *) passed in.
50 tmp->tm_sec = tm->tm_sec;
51 tmp->tm_min = tm->tm_min;
52 tmp->tm_hour = tm->tm_hour;
53 tmp->tm_mday = tm->tm_mday;
54 tmp->tm_mon = tm->tm_mon;
55 tmp->tm_year = tm->tm_year;
56 tmp->tm_wday = tm->tm_wday;
57 tmp->tm_yday = tm->tm_yday;
58 tmp->tm_isdst = tm->tm_isdst;
60 If you don't have tm_zone in (struct tm), but
61 you get at it via the shared tmzone[], you'll
62 lose. Same goes for the tm_gmtoff field.
66 strcpy(tmp->tm_zone,tm->tm_zone);
67 tmp->tm_gmtoff = tm->tm_gmtoff;