diff options
author | unknown <heikki@hundin.mysql.fi> | 2002-06-22 20:41:14 +0300 |
---|---|---|
committer | unknown <heikki@hundin.mysql.fi> | 2002-06-22 20:41:14 +0300 |
commit | 1081513a12851d432103eaabcb6533c84062196c (patch) | |
tree | cd94be28879d52101bd7438dc97dc04856d81739 /innobase/ut/ut0ut.c | |
parent | b7b988b3c36fa7a1f0a284d6478bbccbe706c09f (diff) | |
download | mariadb-git-1081513a12851d432103eaabcb6533c84062196c.tar.gz |
Many files:
Merge 3.23.52
innobase/btr/btr0btr.c:
Merge 3.23.52
innobase/btr/btr0cur.c:
Merge 3.23.52
innobase/btr/btr0sea.c:
Merge 3.23.52
innobase/include/btr0btr.h:
Merge 3.23.52
innobase/include/btr0cur.h:
Merge 3.23.52
innobase/include/btr0sea.h:
Merge 3.23.52
innobase/include/buf0buf.h:
Merge 3.23.52
innobase/include/buf0rea.h:
Merge 3.23.52
innobase/include/data0data.h:
Merge 3.23.52
innobase/include/data0data.ic:
Merge 3.23.52
innobase/include/log0log.h:
Merge 3.23.52
innobase/include/log0log.ic:
Merge 3.23.52
innobase/include/os0file.h:
Merge 3.23.52
innobase/include/page0page.h:
Merge 3.23.52
innobase/include/page0page.ic:
Merge 3.23.52
innobase/include/row0mysql.h:
Merge 3.23.52
innobase/include/trx0roll.h:
Merge 3.23.52
innobase/include/trx0sys.h:
Merge 3.23.52
innobase/include/trx0trx.h:
Merge 3.23.52
innobase/include/ut0ut.h:
Merge 3.23.52
innobase/include/univ.i:
Merge 3.23.52
innobase/include/ut0ut.ic:
Merge 3.23.52
innobase/buf/buf0buf.c:
Merge 3.23.52
innobase/buf/buf0rea.c:
Merge 3.23.52
innobase/data/data0data.c:
Merge 3.23.52
innobase/dict/dict0crea.c:
Merge 3.23.52
innobase/dict/dict0dict.c:
Merge 3.23.52
innobase/dict/dict0load.c:
Merge 3.23.52
innobase/dict/dict0mem.c:
Merge 3.23.52
innobase/fsp/fsp0fsp.c:
Merge 3.23.52
innobase/ibuf/ibuf0ibuf.c:
Merge 3.23.52
innobase/lock/lock0lock.c:
Merge 3.23.52
innobase/log/log0log.c:
Merge 3.23.52
innobase/log/log0recv.c:
Merge 3.23.52
innobase/mtr/mtr0log.c:
Merge 3.23.52
innobase/mtr/mtr0mtr.c:
Merge 3.23.52
innobase/os/os0file.c:
Merge 3.23.52
innobase/page/page0cur.c:
Merge 3.23.52
innobase/page/page0page.c:
Merge 3.23.52
innobase/rem/rem0cmp.c:
Merge 3.23.52
innobase/row/row0ins.c:
Merge 3.23.52
innobase/row/row0mysql.c:
Merge 3.23.52
innobase/row/row0purge.c:
Merge 3.23.52
innobase/row/row0upd.c:
Merge 3.23.52
innobase/srv/srv0srv.c:
Merge 3.23.52
innobase/srv/srv0start.c:
Merge 3.23.52
innobase/trx/trx0roll.c:
Merge 3.23.52
innobase/trx/trx0sys.c:
Merge 3.23.52
innobase/trx/trx0trx.c:
Merge 3.23.52
innobase/trx/trx0undo.c:
Merge 3.23.52
innobase/ut/ut0mem.c:
Merge 3.23.52
innobase/ut/ut0ut.c:
Merge 3.23.52
Diffstat (limited to 'innobase/ut/ut0ut.c')
-rw-r--r-- | innobase/ut/ut0ut.c | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/innobase/ut/ut0ut.c b/innobase/ut/ut0ut.c index 7ee32b9a8e2..6a5f273e731 100644 --- a/innobase/ut/ut0ut.c +++ b/innobase/ut/ut0ut.c @@ -111,6 +111,49 @@ ut_print_timestamp( } /************************************************************** +Sprintfs a timestamp to a buffer. */ + +void +ut_sprintf_timestamp( +/*=================*/ + char* buf) /* in: buffer where to sprintf */ +{ +#ifdef __WIN__ + SYSTEMTIME cal_tm; + + GetLocalTime(&cal_tm); + + sprintf(buf, "%02d%02d%02d %2d:%02d:%02d", + (int)cal_tm.wYear % 100, + (int)cal_tm.wMonth, + (int)cal_tm.wDay, + (int)cal_tm.wHour, + (int)cal_tm.wMinute, + (int)cal_tm.wSecond); +#else + struct tm cal_tm; + struct tm* cal_tm_ptr; + time_t tm; + + time(&tm); + +#ifdef HAVE_LOCALTIME_R + localtime_r(&tm, &cal_tm); + cal_tm_ptr = &cal_tm; +#else + cal_tm_ptr = localtime(&tm); +#endif + sprintf(buf, "%02d%02d%02d %2d:%02d:%02d", + cal_tm_ptr->tm_year % 100, + cal_tm_ptr->tm_mon + 1, + cal_tm_ptr->tm_mday, + cal_tm_ptr->tm_hour, + cal_tm_ptr->tm_min, + cal_tm_ptr->tm_sec); +#endif +} + +/************************************************************** Returns current year, month, day. */ void @@ -258,3 +301,26 @@ ut_ulint_sort(ulint* arr, ulint* aux_arr, ulint low, ulint high) UT_SORT_FUNCTION_BODY(ut_ulint_sort, arr, aux_arr, low, high, ut_ulint_cmp); } + +/***************************************************************** +Calculates fast the number rounded up to the nearest power of 2. */ + +ulint +ut_2_power_up( +/*==========*/ + /* out: first power of 2 which is >= n */ + ulint n) /* in: number != 0 */ +{ + ulint res; + + res = 1; + + ut_ad(n > 0); + + while (res < n) { + res = res * 2; + } + + return(res); +} + |