Graham Fawcett scripsit:

> My TZ is set properly, and using strace I see that the correct
> zoneinfo file is being accessed. "date +%Z" works properly. Any ideas?

The problem with your test program is that tm is uninitialized, which
strptime does not alter (since there is no zone information in the input)
and which causes strftime to bomb.  Using memset(&tm, 0, sizeof(tm))
causes %z to be +0000 (wrong) and %Z to be "EST" (correct).  So that's
not a feasible approach.

Here's a demo program that does work:

#include <stdio.h>
#include <string.h>
#include <time.h>

int main() {
  struct tm * tm;
  char buf[1000];
  time_t t;

  buf[0] = 0;
  t = time(NULL);
  tm = localtime(&t);
  strptime("2008-11-12 18:31:01", "%Y-%m-%d %H:%M:%S", tm);
  strftime(buf, sizeof(buf), "%d %b %Y %H:%M %z %Z", tm);
  puts(buf);
  return 0;
}

However, this doesn't really solve your problem, because it sets
the offset and tzname to the current values, not to the values in
effect at the time.

I admit I don't know how to make progress here.  Let me think on it.

-- 
John Cowan  [EMAIL PROTECTED]   http://www.ccil.org/~cowan
O beautiful for patriot's dream that sees beyond the years
Thine alabaster cities gleam undimmed by human tears!
America! America!  God mend thine every flaw,
Confirm thy soul in self-control, thy liberty in law!
        -- one of the verses not usually taught in U.S. schools


_______________________________________________
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users

Reply via email to