1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 16:17:36 +00:00

Add gettimeofday() syscall and LibC wrappers gettimeofday() and time().

This only has second accuracy right now, I'll work out subseconds later.
This commit is contained in:
Andreas Kling 2018-10-25 17:29:49 +02:00
parent 5978185242
commit dc6f57f19c
20 changed files with 188 additions and 8 deletions

1
Userland/.gitignore vendored
View file

@ -4,4 +4,5 @@ ps
ls
pwd
sleep
date
*.o

View file

@ -4,7 +4,8 @@ OBJS = \
ps.o \
ls.o \
pwd.o \
sleep.o
sleep.o \
date.o
APPS = \
id \
@ -12,7 +13,8 @@ APPS = \
ps \
ls \
pwd \
sleep
sleep \
date
ARCH_FLAGS =
STANDARD_FLAGS = -std=c++17 -nostdinc++ -nostdlib
@ -50,6 +52,9 @@ pwd: pwd.o
sleep: sleep.o
$(LD) -o $@ $(LDFLAGS) $< ../LibC/LibC.a
date: date.o
$(LD) -o $@ $(LDFLAGS) $< ../LibC/LibC.a
.cpp.o:
@echo "CXX $<"; $(CXX) $(CXXFLAGS) -o $@ -c $<

10
Userland/date.cpp Normal file
View file

@ -0,0 +1,10 @@
#include <LibC/time.h>
#include <LibC/stdio.h>
int main(int c, char** v)
{
time_t now = time(nullptr);
printf("%u\n", now);
return 0;
}