mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-07-19 00:50:30 +00:00
Make improvements
- Add GetCpuCount() API to redbean - Add unix.gmtime() API to redbean - Add unix.readlink() API to redbean - Add unix.localtime() API to redbean - Perfect the new redbean UNIX module APIs - Integrate with Linux clock_gettime() vDSO - Run Lua garbage collector when malloc() fails - Fix another regression quirk with linenoise repl - Fix GetProgramExecutableName() for systemwide installs - Fix a build flake with test/libc/mem/test.mk SRCS list
This commit is contained in:
parent
860ea18a87
commit
d57b81aac7
51 changed files with 3096 additions and 1395 deletions
|
@ -25,6 +25,8 @@
|
|||
#include "libc/time/struct/timezone.h"
|
||||
#include "libc/time/time.h"
|
||||
|
||||
static typeof(sys_gettimeofday) *__gettimeofday = sys_gettimeofday;
|
||||
|
||||
/**
|
||||
* Returns system wall time in microseconds.
|
||||
*
|
||||
|
@ -40,7 +42,7 @@ int gettimeofday(struct timeval *tv, struct timezone *tz) {
|
|||
return efault();
|
||||
}
|
||||
if (!IsWindows() && !IsMetal()) {
|
||||
ad = sys_gettimeofday(tv, tz, NULL);
|
||||
ad = __gettimeofday(tv, tz, NULL);
|
||||
assert(ad.ax != -1);
|
||||
if (SupportsXnu() && ad.ax && tv) {
|
||||
tv->tv_sec = ad.ax;
|
||||
|
@ -53,3 +55,14 @@ int gettimeofday(struct timeval *tv, struct timezone *tz) {
|
|||
return sys_gettimeofday_nt(tv, tz);
|
||||
}
|
||||
}
|
||||
|
||||
static textstartup void __gettimeofday_init(void) {
|
||||
void *vdso;
|
||||
if ((vdso = __vdsofunc("__vdso_gettimeofday"))) {
|
||||
__gettimeofday = vdso;
|
||||
}
|
||||
}
|
||||
|
||||
const void *const __gettimeofday_ctor[] initarray = {
|
||||
__gettimeofday_init,
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue