summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Libraries/LibC/sys/time.h1
-rw-r--r--Libraries/LibC/time.cpp7
2 files changed, 8 insertions, 0 deletions
diff --git a/Libraries/LibC/sys/time.h b/Libraries/LibC/sys/time.h
index f660c2b24a..ac3013747e 100644
--- a/Libraries/LibC/sys/time.h
+++ b/Libraries/LibC/sys/time.h
@@ -43,6 +43,7 @@ struct timezone {
};
int gettimeofday(struct timeval* __restrict__, void* __restrict__) __attribute__((nonnull(1)));
+int settimeofday(struct timeval* __restrict__, void* __restrict__) __attribute__((nonnull(1)));
static inline void timeradd(const struct timeval* a, const struct timeval* b, struct timeval* out)
{
diff --git a/Libraries/LibC/time.cpp b/Libraries/LibC/time.cpp
index 5f1c8eeabe..c35cdf84c6 100644
--- a/Libraries/LibC/time.cpp
+++ b/Libraries/LibC/time.cpp
@@ -55,6 +55,13 @@ int gettimeofday(struct timeval* __restrict__ tv, void* __restrict__)
__RETURN_WITH_ERRNO(rc, rc, -1);
}
+int settimeofday(struct timeval* __restrict__ tv, void* __restrict__)
+{
+ timespec ts;
+ TIMEVAL_TO_TIMESPEC(tv, &ts);
+ return clock_settime(CLOCK_REALTIME, &ts);
+}
+
char* ctime(const time_t* t)
{
return asctime(localtime(t));