about summary refs log tree commit diff
path: root/include/time.h
Commit message (Collapse)AuthorAgeFilesLines
* fix const-correctness of argument to stimeRich Felker2014-01-071-1/+1
| | | | | | | it's unclear what the historical signature for this function was, but semantically, the argument should be a pointer to const, and this is what glibc uses. correct programs should not be using this function anyway, so it's unlikely to matter.
* restore type of NULL to void * except when used in C++ programsRich Felker2013-11-241-0/+5
| | | | | | | | | | | | | | unfortunately this eliminates the ability of the compiler to diagnose some dangerous/incorrect usage, but POSIX requires (as an extension to the C language, i.e. CX shaded) that NULL have type void *. plain C allows it to be defined as any null pointer constant. the definition 0L is preserved for C++ rather than reverting to plain 0 to avoid dangerous behavior in non-conforming programs which use NULL as a variadic sentinel. (it's impossible to use (void *)0 for C++ since C++ lacks the proper implicit pointer conversions, and other popular alternatives like the GCC __null extension seem non-conforming to the standard's requirements.)
* fix clockid macro names in time.h, reported by Paul SchutteSzabolcs Nagy2013-10-071-2/+2
|
* add CLOCK_TAI (and CLOCK_SGI_CYCLE) clock ids to time.hSzabolcs Nagy2013-07-241-0/+2
| | | | added in linux-v3.10 commit 1ff3c9677bff7e468e0c487d0ffefe4e901d33f4
* add clock id macros for a number of new(ish) Linux-specific clocksRich Felker2013-06-081-0/+6
| | | | | | | | | | arguably CLOCK_MONOTONIC should be redirected to CLOCK_BOOTTIME with a fallback for old kernels that don't support it, since Linux's CLOCK_BOOTTIME semantics seem to match the spirit of the POSIX requirements for CLOCK_MONOTONIC better than Linux's version of CLOCK_MONOTONIC does. however, this is a change that would require further discussion and research, so for now, I'm simply making them all available.
* fix the type of CLOCKS_PER_SEC to match new clock_t typeRich Felker2013-06-081-1/+1
| | | | | | originally it was right on 32-bit archs and wrong on 64-bit, but after recent changes it was wrong everywhere. with this commit, it's now right everywhere.
* improve handling of nonstandard fields in struct tmRich Felker2013-06-071-4/+5
| | | | | defining tm_gmtoff and tm_zone as macros was breaking some application code that used these names for its own purposes.
* make tm_zone etc visible under _GNU_SOURCErofl0r2013-04-021-1/+1
|
* use a common definition of NULL as 0L for C and C++Rich Felker2013-01-181-7/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | the historical mess of having different definitions for C and C++ comes from the historical C definition as (void *)0 and the fact that (void *)0 can't be used in C++ because it does not convert to other pointer types implicitly. however, using plain 0 in C++ exposed bugs in C++ programs that call variadic functions with NULL as an argument and (wrongly; this is UB) expect it to arrive as a null pointer. on 64-bit machines, the high bits end up containing junk. glibc dodges the issue by using a GCC extension __null to define NULL; this is observably non-conforming because a conforming application could observe the definition of NULL via stringizing and see that it is neither an integer constant expression with value zero nor such an expression cast to void. switching to 0L eliminates the issue and provides compatibility with broken applications, since on all musl targets, long and pointers have the same size, representation, and argument-passing convention. we could maintain separate C and C++ definitions of NULL (i.e. just use 0L on C++ and use (void *)0 on C) but after careful analysis, it seems extremely difficult for a C program to even determine whether NULL has integer or pointer type, much less depend in subtle, unintentional ways, on whether it does. C89 seems to have no way to make the distinction. on C99, the fact that (int)(void *)0 is not an integer constant expression, along with subtle VLA/sizeof semantics, can be used to make the distinction, but many compilers are non-conforming and give the wrong result to this test anyway. on C11, _Generic can trivially make the distinction, but it seems unlikely that code targetting C11 would be so backwards in caring which definition of NULL an implementation uses. as such, the simplest path of using the same definition for NULL in both C and C++ was chosen. the #undef directive was also removed so that the compiler can catch and give a warning or error on redefinition if buggy programs have defined their own versions of NULL prior to inclusion of standard headers.
* time.h: add BSD aliases for otherwise internal struct tm membersrofl0r2013-01-041-0/+4
|
* default features: make musl usable without feature test macrosRich Felker2012-09-071-5/+1
| | | | | | | | | | the old behavior of exposing nothing except plain ISO C can be obtained by defining __STRICT_ANSI__ or using a compiler option (such as -std=c99) that predefines it. the new default featureset is POSIX with XSI plus _BSD_SOURCE. any explicit feature test macros will inhibit the default. installation docs have also been updated to reflect this change.
* use restrict everywhere it's required by c99 and/or posix 2008Rich Felker2012-09-061-8/+14
| | | | | | | | to deal with the fact that the public headers may be used with pre-c99 compilers, __restrict is used in place of restrict, and defined appropriately for any supported compiler. we also avoid the form [restrict] since older versions of gcc rejected it due to a bug in the original c99 standard, and instead use the form *restrict.
* revert one change in time.h; no evidence BSD_SOURCE should expose these..Rich Felker2012-06-131-1/+1
|
* fix feature test macros in time.hRich Felker2012-06-131-5/+2
| | | | | stime is not _XOPEN_SOURCE, and some functions were missing with _BSD_SOURCE..
* add timegm function (inverse of gmtime), nonstandardRich Felker2012-06-131-0/+3
|
* support _BSD_SOURCE feature test macroRich Felker2012-05-221-2/+4
| | | | | patch by Isaac Dunham. matched closely (maybe not exact) to glibc's idea of what _BSD_SOURCE should make visible.
* legacy junk compatibility grab-bagRich Felker2012-04-181-0/+5
| | | | | | - add the rest of the junk traditionally in sys/param.h - add prototypes for some nonstandard functions - add _GNU_SOURCE to their source files so the compiler can check proto
* more locale_t interfaces (string stuff) and header updatesRich Felker2012-02-061-0/+3
| | | | | | this should be everything except for some functions where the non-_l version isn't even implemented yet (mainly some non-ISO-C wcs* functions).
* cleanup various minor issues reported by nszRich Felker2011-09-261-1/+0
| | | | | | | | | the changes to syscall_ret are mostly no-ops in the generated code, just cleanup of type issues and removal of some implementation-defined behavior. the one exception is the change in the comparison value, which is fixed so that 0xf...f000 (which in principle could be a valid return value for mmap, although probably never in reality) is not treated as an error return.
* fix various errors in function signatures/prototypes found by nszRich Felker2011-09-131-1/+1
|
* fix another error from header cleanup, missing size_t in time.hRich Felker2011-02-151-1/+1
|
* more header cleanup and conformance fixes - locale.h, time.hRich Felker2011-02-141-34/+35
|
* initial check-in, version 0.5.0 v0.5.0Rich Felker2011-02-121-0/+113