Ticket #286: timegm-osx.diff

File timegm-osx.diff, 1.0 KB (added by Jim Ursetto, 13 years ago)

Use portable timegm on OS X

  • posixunix.scm

    diff --git a/posixunix.scm b/posixunix.scm
    index 6b5ffc9..c90481a 100644
    a b static C_TLS sigset_t C_sigset; 
    308308
    309309#define C_ctime(n)          (C_secs = (n), ctime(&C_secs))
    310310
    311 #if defined(__SVR4)
     311#if defined(__SVR4) || defined(C_MACOSX)
    312312/* Seen here: http://lists.samba.org/archive/samba-technical/2002-November/025571.html */
    313313
    314 static time_t timegm(struct tm *t)
     314static time_t C_timegm(struct tm *t)
    315315{
    316316  time_t tl, tb;
    317317  struct tm *tg;
    static time_t timegm(struct tm *t) 
    338338    }
    339339  return (tl - (tb - tl));
    340340}
     341#else
     342#define C_timegm timegm
    341343#endif
    342344
    343345#define cpy_tmvec_to_tmstc08(ptm, v) \
    C_tm_get( C_word v ) 
    413415
    414416#define C_asctime(v)    (asctime(C_tm_set(v)))
    415417#define C_a_mktime(ptr, c, v)  C_flonum(ptr, mktime(C_tm_set(v)))
    416 #define C_a_timegm(ptr, c, v)  C_flonum(ptr, timegm(C_tm_set(v)))
     418#define C_a_timegm(ptr, c, v)  C_flonum(ptr, C_timegm(C_tm_set(v)))
    417419
    418420#define TIME_STRING_MAXLENGTH 255
    419421static char C_time_string [TIME_STRING_MAXLENGTH + 1];