Changeset 205f1add in mainline for uspace/lib/posix
- Timestamp:
- 2018-08-23T21:14:56Z (8 years ago)
- Children:
- f33c989e
- Parents:
- e2625b1a
- git-author:
- Jakub Jermar <jakub@…> (2018-08-21 21:58:52)
- git-committer:
- Jakub Jermar <jakub@…> (2018-08-23 21:14:56)
- Location:
- uspace/lib/posix
- Files:
-
- 5 edited
-
include/posix/sys/time.h (modified) (1 diff)
-
include/posix/sys/types.h (modified) (2 diffs)
-
include/posix/time.h (modified) (3 diffs)
-
src/internal/common.h (modified) (1 diff)
-
src/time.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/posix/include/posix/sys/time.h
re2625b1a r205f1add 34 34 #define POSIX_SYS_TIME_H_ 35 35 36 #include "libc/sys/time.h"37 38 36 #endif 39 37 -
uspace/lib/posix/include/posix/sys/types.h
re2625b1a r205f1add 38 38 39 39 #include "libc/offset.h" 40 #include "libc/sys/time.h"41 40 #include "libc/types/common.h" 42 41 … … 56 55 57 56 /* Clock Types */ 58 typedef long clock_t;59 57 typedef int clockid_t; 60 61 58 62 59 #endif /* POSIX_SYS_TYPES_H_ */ -
uspace/lib/posix/include/posix/time.h
re2625b1a r205f1add 41 41 #include <_bits/NULL.h> 42 42 43 #include "libc/time.h" 44 43 45 #ifndef CLOCKS_PER_SEC 44 46 #define CLOCKS_PER_SEC (1000000L) … … 57 59 #define CLOCK_REALTIME ((clockid_t) 0) 58 60 59 struct timespec { 60 time_t tv_sec; /* Seconds. */ 61 long tv_nsec; /* Nanoseconds. */ 61 #define DST_NONE 0 62 63 #define ASCTIME_BUF_LEN 26 64 65 typedef long suseconds_t; 66 67 struct timeval { 68 time_t tv_sec; /* seconds */ 69 suseconds_t tv_usec; /* microseconds */ 70 }; 71 72 struct timezone { 73 int tz_minuteswest; /* minutes W of Greenwich */ 74 int tz_dsttime; /* type of dst correction */ 62 75 }; 63 76 … … 107 120 extern clock_t clock(void); 108 121 122 extern int gettimeofday(struct timeval *, struct timezone *); 109 123 110 124 #endif // POSIX_TIME_H_ -
uspace/lib/posix/src/internal/common.h
re2625b1a r205f1add 38 38 #include <stdio.h> 39 39 #include <stdlib.h> 40 #include <errno.h> 40 41 #include <offset.h> 41 42 #include <vfs/vfs.h> -
uspace/lib/posix/src/time.c
re2625b1a r205f1add 49 49 #include "libc/stats.h" 50 50 #include "libc/stddef.h" 51 #include "libc/ sys/time.h"51 #include "libc/time.h" 52 52 53 53 // TODO: test everything in this file … … 328 328 } 329 329 330 int gettimeofday(struct timeval *tv, struct timezone *tz) 331 { 332 struct timespec ts; 333 334 getrealtime(&ts); 335 tv->tv_sec = ts.tv_sec; 336 tv->tv_usec = NSEC2USEC(ts.tv_nsec); 337 338 return 0; 339 } 340 330 341 /** @} 331 342 */
Note:
See TracChangeset
for help on using the changeset viewer.
