Changeset 3424 for trunk/gsdl/lib


Ignore:
Timestamp:
2002-09-13T14:52:20+12:00 (22 years ago)
Author:
jrm21
Message:

Need some slightly extra stuff for converting times when under darwin.
(Otherwise keys expire immediately under collector on darwin).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsdl/lib/gsdltimes.cpp

    r1785 r3424  
    2929// Coordinated Universal Time (UTC))
    3030// returns "" if an error occurs
     31// !! Actually, we now return a string in localtime, as text2time returns
     32//    a time in localtime (mktime assumes local timezone). - jrm21 Sep 2002
    3133text_t time2text (time_t time) {
    32   tm *tm_ptr = gmtime(&time);
     34  // tm *tm_ptr = gmtime(&time);
     35  tm *tm_ptr = localtime(&time);
     36
    3337  if (tm_ptr == NULL) return "";
    3438
     
    113117  if (timetm.tm_sec < 0 || timetm.tm_sec > 59)
    114118    return (time_t) -1;
    115  
     119
     120  timetm.tm_isdst=0;
     121
     122  /* This is for darwin - mktime seems to use this, so don't leave it
     123     uninitialised!! Maybe the same on freebsd/netbsd?
     124     I read somewhere that APOLLO and AUX #define BSD but don't have this,
     125     however that was dated 1995...
     126  */
     127#if defined(BSD)
     128  timetm.tm_gmtoff=0;
     129#endif
     130
     131  // mktime assumes timetm is localtime
    116132  return mktime (&timetm);
    117133}
Note: See TracChangeset for help on using the changeset viewer.