aboutsummaryrefslogtreecommitdiff
path: root/sysdeps/posix
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/posix')
-rw-r--r--sysdeps/posix/tempname.c9
-rw-r--r--sysdeps/posix/timespec_get.c14
2 files changed, 8 insertions, 15 deletions
diff --git a/sysdeps/posix/tempname.c b/sysdeps/posix/tempname.c
index a248472..692c336 100644
--- a/sysdeps/posix/tempname.c
+++ b/sysdeps/posix/tempname.c
@@ -50,7 +50,7 @@
#include <string.h>
#include <fcntl.h>
-#include <sys/time.h>
+#include <time.h>
#include <stdint.h>
#include <unistd.h>
@@ -63,7 +63,6 @@
# define struct_stat64 struct stat
# define __gen_tempname gen_tempname
# define __getpid getpid
-# define __gettimeofday gettimeofday
# define __mkdir mkdir
# define __open open
# define __lxstat64(version, file, buf) lstat (file, buf)
@@ -76,9 +75,9 @@
# else
# define RANDOM_BITS(Var) \
{ \
- struct timeval tv; \
- __gettimeofday (&tv, NULL); \
- (Var) = ((uint64_t) tv.tv_usec << 16) ^ tv.tv_sec; \
+ struct timespec ts; \
+ clock_gettime (CLOCK_REALTIME, &ts); \
+ (Var) = ((uint64_t) tv.tv_nsec << 16) ^ tv.tv_sec; \
}
#endif
diff --git a/sysdeps/posix/timespec_get.c b/sysdeps/posix/timespec_get.c
index 1fc18ac..e3146da 100644
--- a/sysdeps/posix/timespec_get.c
+++ b/sysdeps/posix/timespec_get.c
@@ -23,16 +23,10 @@
int
timespec_get (struct timespec *ts, int base)
{
- switch (base)
+ if (base == TIME_UTC)
{
- case TIME_UTC:
- if (__clock_gettime (CLOCK_REALTIME, ts) < 0)
- return 0;
- break;
-
- default:
- return 0;
+ __clock_gettime (CLOCK_REALTIME, ts);
+ return base;
}
-
- return base;
+ return 0;
}