diff options
Diffstat (limited to 'mysys/my_getsystime.c')
-rw-r--r-- | mysys/my_getsystime.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/mysys/my_getsystime.c b/mysys/my_getsystime.c index 64480c4aa7a..c6086b84537 100644 --- a/mysys/my_getsystime.c +++ b/mysys/my_getsystime.c @@ -1,4 +1,5 @@ -/* Copyright (C) 2004 MySQL AB +/* Copyright (c) 2004, 2011, Oracle and/or its affiliates. + Copyright (c) 2009-2011 Monty Program Ab This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -170,7 +171,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; |