summaryrefslogtreecommitdiff
path: root/Userland
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2018-10-25 17:29:49 +0200
committerAndreas Kling <awesomekling@gmail.com>2018-10-25 17:36:18 +0200
commitdc6f57f19cff71c6bd83a42fd58a93adbbeb70cb (patch)
tree8b7d250141b3666063775f3fff0213e99e20fa3f /Userland
parent597818524277bf24a2d6b10f540cbf2c34c2bb34 (diff)
downloadserenity-dc6f57f19cff71c6bd83a42fd58a93adbbeb70cb.zip
Add gettimeofday() syscall and LibC wrappers gettimeofday() and time().
This only has second accuracy right now, I'll work out subseconds later.
Diffstat (limited to 'Userland')
-rw-r--r--Userland/.gitignore1
-rw-r--r--Userland/Makefile9
-rw-r--r--Userland/date.cpp10
3 files changed, 18 insertions, 2 deletions
diff --git a/Userland/.gitignore b/Userland/.gitignore
index 9effb83fcc..e17fc11729 100644
--- a/Userland/.gitignore
+++ b/Userland/.gitignore
@@ -4,4 +4,5 @@ ps
ls
pwd
sleep
+date
*.o
diff --git a/Userland/Makefile b/Userland/Makefile
index 20e729d999..1615f689b5 100644
--- a/Userland/Makefile
+++ b/Userland/Makefile
@@ -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 $<
diff --git a/Userland/date.cpp b/Userland/date.cpp
new file mode 100644
index 0000000000..00738773c5
--- /dev/null
+++ b/Userland/date.cpp
@@ -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;
+}
+