Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: LGPL-2.1 OR MIT */
0002 /*
0003  * time function definitions for NOLIBC
0004  * Copyright (C) 2017-2022 Willy Tarreau <w@1wt.eu>
0005  */
0006 
0007 #ifndef _NOLIBC_TIME_H
0008 #define _NOLIBC_TIME_H
0009 
0010 #include "std.h"
0011 #include "arch.h"
0012 #include "types.h"
0013 #include "sys.h"
0014 
0015 static __attribute__((unused))
0016 time_t time(time_t *tptr)
0017 {
0018     struct timeval tv;
0019 
0020     /* note, cannot fail here */
0021     sys_gettimeofday(&tv, NULL);
0022 
0023     if (tptr)
0024         *tptr = tv.tv_sec;
0025     return tv.tv_sec;
0026 }
0027 
0028 #endif /* _NOLIBC_TIME_H */