summaryrefslogtreecommitdiff
path: root/mysys/my_getsystime.c
diff options
context:
space:
mode:
authorDavi Arnaut <davi.arnaut@oracle.com>2011-01-11 11:53:50 -0200
committerDavi Arnaut <davi.arnaut@oracle.com>2011-01-11 11:53:50 -0200
commit5387af005d672e73f7db99bf3202873c39128f1a (patch)
tree9bc7bd54a3008f8a5c2dd5f29799120be4023955 /mysys/my_getsystime.c
parent61b5b3e48a24d7d3842794ef5856c33e70cc6835 (diff)
parentc4c94ea0ac2141d70cb7225cdb8f30320dc73f08 (diff)
downloadmariadb-git-5387af005d672e73f7db99bf3202873c39128f1a.tar.gz
Merge of mysql-5.1 into mysql-5.5.
Diffstat (limited to 'mysys/my_getsystime.c')
-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 cc5d1b83efb..614f49fc425 100644
--- a/mysys/my_getsystime.c
+++ b/mysys/my_getsystime.c
@@ -165,7 +165,13 @@ ulonglong my_micro_time_and_time(time_t *time_arg)
mysql_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;