[Ecls-list] Datetime bug (gmt?)

Stanislav Frolov frolosofsky at gmail.com
Thu Aug 2 14:01:19 UTC 2012


> Could it be rather a problem with summer time? ECL relies on the C library
> for the timezone and the summer time (see src/c/mislib.lsp) and it seems to
> work for Spain

Maybe. Last year, Russia hasn't summer/winter time transition.

I have read the code src/lisp/mislib.lsp and found ECL don't uses 
tzset/timezone for time zone detection (HAVE_TZSET set to 1). I debug function 
get-local-time-zone, it return -3 instead of -4.

I found in source next code

  #if 0 && defined(HAVE_TZSET)
  tzset();
  mw = timezone/60;
  #endif

Why 0?

Simple test code 'tzset(); timezone/60/60'; evaluates in '-4'. So, problem in:

  struct tm ltm, gtm;
  time_t when = 0L;

  ltm = *localtime(&when);
  gtm = *gmtime(&when);
        
  mw = (gtm.tm_min + 60 * gtm.tm_hour) - (ltm.tm_min + 60 * ltm.tm_hour);
        
  if ((gtm.tm_wday + 1) % 7 == ltm.tm_wday)
    mw -= 24*60;
  else if (gtm.tm_wday == (ltm.tm_wday + 1) % 7)
    mw += 24*60;

But i don't understand this code :(




More information about the ecl-devel mailing list