summaryrefslogtreecommitdiff
path: root/mysys
diff options
context:
space:
mode:
Diffstat (limited to 'mysys')
-rw-r--r--mysys/my_getsystime.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/mysys/my_getsystime.c b/mysys/my_getsystime.c
index b692b18bfc7..dfd99f6380d 100644
--- a/mysys/my_getsystime.c
+++ b/mysys/my_getsystime.c
@@ -170,7 +170,13 @@ ulonglong my_micro_time_and_time(time_t *time_arg)
pthread_mutex_lock(&THR_LOCK_time);
cur_gethrtime= gethrtime();
- if ((cur_gethrtime - prev_gethrtime) > DELTA_FOR_SECONDS)
+ /*
+ Due to bugs in the Solaris (x86) implementation of gethrtime(),
+ the time returned by it might not be monotonic. Don't use the
+ cached time(2) value if this is a case.
+ */
+ if ((prev_gethrtime > cur_gethrtime) ||
+ ((cur_gethrtime - prev_gethrtime) > DELTA_FOR_SECONDS))
{
cur_time= time(0);
prev_gethrtime= cur_gethrtime;