[Coldstuff] patch for GMT offset
brandon@roguetrader.com
brandon@roguetrader.com
Wed, 12 Dec 2001 09:35:54 -0700
--tThc/1wpZn/ma/RB
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Attached is a patch against 1.1.9 which will make GMT offset be valid
for all platforms (currently it only works on BSD platforms).
-Brandon
--tThc/1wpZn/ma/RB
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=gmtoff_patch
*** /svc/ftp/cold/src/stable/Genesis-1.1.9-STABLE/src/ops/misc.c Sun Oct 1 15:35:30 2000
--- Genesis-1.1.9-STABLE/src/ops/misc.c Wed Dec 12 09:34:02 2001
***************
*** 15,20 ****
--- 15,25 ----
#include "util.h"
#include "opcodes.h"
+ #ifndef HAVE_TM_GMTOFF
+ static int last_gmtoffcheck = -1;
+ static int gmt_offset = -1;
+ #endif
+
void func_anticipate_assignment(void) {
Int opcode, ind;
Long id;
***************
*** 75,80 ****
--- 80,88 ----
time_t t;
cData *args;
Int nargs;
+ #ifndef HAVE_TM_GMTOFF
+ struct tm * gtms;
+ #endif
if (!func_init_0_or_1(&args, &nargs, INTEGER))
return;
***************
*** 124,130 ****
#ifdef HAVE_TM_GMTOFF
d[11].u.val = tms->tm_gmtoff;
#else
! d[11].u.val = 0;
#endif
push_list(l);
--- 132,144 ----
#ifdef HAVE_TM_GMTOFF
d[11].u.val = tms->tm_gmtoff;
#else
! if (last_gmtoffcheck != tms->tm_yday) {
! int hour = tms->tm_hour; /* they use the same internal structure */
! gtms = gmtime(&t);
! gmt_offset = ((hour - gtms->tm_hour) * 60 * 60);
! last_gmtoffcheck = tms->tm_yday;
! }
! d[11].u.val = gmt_offset;
#endif
push_list(l);
--tThc/1wpZn/ma/RB--