mailing list of musl libc
 help / color / mirror / code / Atom feed
* localtime() isn't local
@ 2012-10-26  7:57 Yoran Heling
  2012-10-26  8:15 ` Szabolcs Nagy
  0 siblings, 1 reply; 10+ messages in thread
From: Yoran Heling @ 2012-10-26  7:57 UTC (permalink / raw)
  To: musl

Hello,

I noticed that the localtime() function is equivalent to gmtime() on my
system. Following example illustrates the problem:

  $ cat localtime.c

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

  int main(int argc, char **argv) {
    char local[16], global[16];
    time_t tm = time(NULL);
    strftime(local, 10, "%H:%M:%S ", localtime(&tm));
    strftime(global, 10, "%H:%M:%S ", gmtime(&tm));
    printf("Local:  %s\nGlobal: %s\n", local, global);
    return 0;
  }

  $ musl-gcc localtime.c -o localtime-musl
  $ gcc localtime.c -o localtime-glibc
  $ ./localtime-musl
  Local:  07:53:47 
  Global: 07:53:47
  $ ./localtime-glibc
  Local:  09:53:50 
  Global: 07:53:50
  $ date
  Fri Oct 26 09:53:51 CEST 2012

This is on Arch Linux x86_64 with musl v0.9.6-88-g607b05a (that is, the
current git master).

Yoran.


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2012-10-26 21:54 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-10-26  7:57 localtime() isn't local Yoran Heling
2012-10-26  8:15 ` Szabolcs Nagy
2012-10-26  8:34   ` Yoran Heling
2012-10-26 12:00     ` Szabolcs Nagy
2012-10-26 12:26       ` Rich Felker
2012-10-26 14:37         ` Isaac Dunham
2012-10-26 16:25           ` Szabolcs Nagy
2012-10-26 17:25             ` Isaac Dunham
2012-10-26 17:41             ` Rich Felker
2012-10-26 21:54     ` Rich Felker

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).