mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-02-07 15:03:34 +00:00
Cosmopolitan now supports 104 time zones. They're embedded inside any binary that links the localtime() function. Doing so adds about 100kb to the binary size. This change also gets time zones working properly on Windows for the first time. It's not needed to have /etc/localtime exist on Windows, since we can get this information from WIN32. We're also now updated to the latest version of Paul Eggert's TZ library.
22 lines
850 B
C
22 lines
850 B
C
/*-*- mode:c;indent-tabs-mode:t;c-basic-offset:8;tab-width:8;coding:utf-8 -*-│
|
|
│ vi: set noet ft=c ts=8 sw=8 fenc=utf-8 :vi │
|
|
╚─────────────────────────────────────────────────────────────────────────────*/
|
|
#include "libc/calls/weirdtypes.h"
|
|
#include "libc/time.h"
|
|
|
|
/**
|
|
* Represents time as string.
|
|
* @threadunsafe
|
|
*/
|
|
char *
|
|
ctime(const time_t *timep)
|
|
{
|
|
/*
|
|
** Section 4.12.3.2 of X3.159-1989 requires that
|
|
** The ctime function converts the calendar time pointed to by timer
|
|
** to local time in the form of a string. It is equivalent to
|
|
** asctime(localtime(timer))
|
|
*/
|
|
struct tm *tmp = localtime(timep);
|
|
return tmp ? asctime(tmp) : NULL;
|
|
}
|