mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 22:47:44 +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:
parent
5978185242
commit
dc6f57f19c
20 changed files with 188 additions and 8 deletions
1
Userland/.gitignore
vendored
1
Userland/.gitignore
vendored
|
@ -4,4 +4,5 @@ ps
|
|||
ls
|
||||
pwd
|
||||
sleep
|
||||
date
|
||||
*.o
|
||||
|
|
|
@ -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
10
Userland/date.cpp
Normal 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;
|
||||
}
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue