diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2019-07-25 12:08:50 +0300 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2019-07-25 12:14:27 +0300 |
commit | b6ac67389dfed3255004b82d29625577c3335a0a (patch) | |
tree | ca6d71736e041ee0f8db949f2609a395b9e724c7 /storage/innobase/ut/ut0ut.cc | |
parent | ee555f8fc5fed02503d45cc4ad0d08b07d5a6355 (diff) | |
parent | 8d0dabc56b09c6b40db15aac7da0da43d988759d (diff) | |
download | mariadb-git-b6ac67389dfed3255004b82d29625577c3335a0a.tar.gz |
Merge 10.1 into 10.2
Diffstat (limited to 'storage/innobase/ut/ut0ut.cc')
-rw-r--r-- | storage/innobase/ut/ut0ut.cc | 119 |
1 files changed, 0 insertions, 119 deletions
diff --git a/storage/innobase/ut/ut0ut.cc b/storage/innobase/ut/ut0ut.cc index aa73ee010fc..252f3a50ae1 100644 --- a/storage/innobase/ut/ut0ut.cc +++ b/storage/innobase/ut/ut0ut.cc @@ -38,112 +38,6 @@ Created 5/11/1994 Heikki Tuuri #include <string> #include "log.h" -#ifdef _WIN32 -typedef VOID(WINAPI *time_fn)(LPFILETIME); -static time_fn ut_get_system_time_as_file_time = GetSystemTimeAsFileTime; - -/*****************************************************************//** -NOTE: The Windows epoch starts from 1601/01/01 whereas the Unix -epoch starts from 1970/1/1. For selection of constant see: -http://support.microsoft.com/kb/167296/ */ -#define WIN_TO_UNIX_DELTA_USEC 11644473600000000LL - - -/*****************************************************************//** -This is the Windows version of gettimeofday(2). -@return 0 if all OK else -1 */ -static -int -ut_gettimeofday( -/*============*/ - struct timeval* tv, /*!< out: Values are relative to Unix epoch */ - void* tz) /*!< in: not used */ -{ - FILETIME ft; - int64_t tm; - - if (!tv) { - errno = EINVAL; - return(-1); - } - - ut_get_system_time_as_file_time(&ft); - - tm = (int64_t) ft.dwHighDateTime << 32; - tm |= ft.dwLowDateTime; - - ut_a(tm >= 0); /* If tm wraps over to negative, the quotient / 10 - does not work */ - - tm /= 10; /* Convert from 100 nsec periods to usec */ - - /* If we don't convert to the Unix epoch the value for - struct timeval::tv_sec will overflow.*/ - tm -= WIN_TO_UNIX_DELTA_USEC; - - tv->tv_sec = (long) (tm / 1000000L); - tv->tv_usec = (long) (tm % 1000000L); - - return(0); -} -#else -/** An alias for gettimeofday(2). On Microsoft Windows, we have to -reimplement this function. */ -#define ut_gettimeofday gettimeofday -#endif - -/**********************************************************//** -Returns system time. We do not specify the format of the time returned: -the only way to manipulate it is to use the function ut_difftime. -@return system time */ -ib_time_t -ut_time(void) -/*=========*/ -{ - return(time(NULL)); -} - - -/**********************************************************//** -Returns system time. -Upon successful completion, the value 0 is returned; otherwise the -value -1 is returned and the global variable errno is set to indicate the -error. -@return 0 on success, -1 otherwise */ -int -ut_usectime( -/*========*/ - ulint* sec, /*!< out: seconds since the Epoch */ - ulint* ms) /*!< out: microseconds since the Epoch+*sec */ -{ - struct timeval tv; - int ret; - int errno_gettimeofday; - int i; - - for (i = 0; i < 10; i++) { - - ret = ut_gettimeofday(&tv, NULL); - - if (ret == -1) { - errno_gettimeofday = errno; - ib::error() << "gettimeofday(): " - << strerror(errno_gettimeofday); - os_thread_sleep(100000); /* 0.1 sec */ - errno = errno_gettimeofday; - } else { - break; - } - } - - if (ret != -1) { - *sec = (ulint) tv.tv_sec; - *ms = (ulint) tv.tv_usec; - } - - return(ret); -} - /**********************************************************//** Returns the number of milliseconds since some epoch. The value may wrap around. It should only be used for heuristic @@ -155,19 +49,6 @@ ut_time_ms(void) { return static_cast<ulint>(my_interval_timer() / 1000000); } - -/**********************************************************//** -Returns the difference of two times in seconds. -@return time2 - time1 expressed in seconds */ -double -ut_difftime( -/*========*/ - ib_time_t time2, /*!< in: time */ - ib_time_t time1) /*!< in: time */ -{ - return(difftime(time2, time1)); -} - #endif /* !UNIV_INNOCHECKSUM */ /**********************************************************//** |