[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Chicken-users] choosing right timezone for future date
From: |
Graham Fawcett |
Subject: |
Re: [Chicken-users] choosing right timezone for future date |
Date: |
Mon, 28 Jan 2008 16:41:31 -0500 |
On Jan 28, 2008 3:45 PM, Graham Fawcett <address@hidden> wrote:
> > strftime(3), which should be in unit posix but isn't, is your friend;
> > it's the library routine underlying date(1).
John, I'm seeing an odd behaviour with strftime on my machine; perhaps
you've seen it before and might be able to spot the problem.
The manpage for strptime gives the following example program, to which
I added "%Z %z" in the strftime line:
#include <stdio.h>
#include <time.h>
int main() {
struct tm tm;
char buf[255];
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;
}
but the output I get is:
$ ./a.out
12 Nov 2008 18:31 \360\204<more arbitrary bytes>
My TZ is set properly, and using strace I see that the correct
zoneinfo file is being accessed. "date +%Z" works properly. Any ideas?
Thanks,
Graham