mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-26 09:30:24 +00:00
LibC: Add settimeofday
This commit is contained in:
parent
0736ae4116
commit
0fff4e11a6
Notes:
sideshowbarker
2024-07-19 02:52:01 +09:00
Author: https://github.com/nico Commit: https://github.com/SerenityOS/serenity/commit/0fff4e11a68 Pull-request: https://github.com/SerenityOS/serenity/pull/3410 Reviewed-by: https://github.com/asynts Reviewed-by: https://github.com/awesomekling
2 changed files with 8 additions and 0 deletions
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -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));
|
||||
|
|
Loading…
Reference in a new issue