diff options
author | unknown <heikki@donna.mysql.fi> | 2001-05-24 22:35:14 +0300 |
---|---|---|
committer | unknown <heikki@donna.mysql.fi> | 2001-05-24 22:35:14 +0300 |
commit | b6098186662faaef749577b027d49c928a80fa2e (patch) | |
tree | 6d16da7ee7c62f996ff34bdabd1a7f6e820d7f9c /innobase/ut | |
parent | 32d369378e4292a5d859f6edea95f6a396013dfc (diff) | |
download | mariadb-git-b6098186662faaef749577b027d49c928a80fa2e.tar.gz |
log0log.c InnoDB now prints timestamp at startup and shutdown
srv0start.c InnoDB now prints timestamp at startup and shutdown
ut0ut.h InnoDB now prints timestamp at startup and shutdown
ut0ut.c InnoDB now prints timestamp at startup and shutdown
innobase/ut/ut0ut.c:
InnoDB now prints timestamp at startup and shutdown
innobase/include/ut0ut.h:
InnoDB now prints timestamp at startup and shutdown
innobase/srv/srv0start.c:
InnoDB now prints timestamp at startup and shutdown
innobase/log/log0log.c:
InnoDB now prints timestamp at startup and shutdown
Diffstat (limited to 'innobase/ut')
-rw-r--r-- | innobase/ut/ut0ut.c | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/innobase/ut/ut0ut.c b/innobase/ut/ut0ut.c index cfd714fc275..cae0c3819f3 100644 --- a/innobase/ut/ut0ut.c +++ b/innobase/ut/ut0ut.c @@ -49,6 +49,43 @@ ut_difftime( return(difftime(time2, time1)); } +/************************************************************** +Prints a timestamp to a file. */ + +void +ut_print_timestamp( +/*===============*/ + FILE* file) /* in: file where to print */ +{ + struct tm* cal_tm_ptr; + struct tm cal_tm; + time_t tm; + + try_again: + time(&tm); + + cal_tm_ptr = localtime(&tm); + + memcpy(&cal_tm, cal_tm_ptr, sizeof(struct tm)); + + /* In theory localtime may return a wrong result because its return + struct is not protected with a mutex */ + + if (difftime(tm, mktime(&cal_tm)) > 0.5 + || difftime(tm, mktime(&cal_tm)) < -0.5) { + + goto try_again; + } + + fprintf(file,"%02d%02d%02d %2d:%02d:%02d", + cal_tm.tm_year % 100, + cal_tm.tm_mon+1, + cal_tm.tm_mday, + cal_tm.tm_hour, + cal_tm.tm_min, + cal_tm.tm_sec); +} + /***************************************************************** Runs an idle loop on CPU. The argument gives the desired delay in microseconds on 100 MHz Pentium + Visual C++. */ |