diff options
author | unknown <heikki@hundin.mysql.fi> | 2002-03-21 18:03:09 +0200 |
---|---|---|
committer | unknown <heikki@hundin.mysql.fi> | 2002-03-21 18:03:09 +0200 |
commit | d3c0752b6aec6afef1f0dba85c9a0f1237843e6d (patch) | |
tree | 8484c3bb65d40af0743b44a24a788dc2d5cf7d48 /innobase/ut | |
parent | 838c6427b278a016f968338468761dabcfecba29 (diff) | |
download | mariadb-git-d3c0752b6aec6afef1f0dba85c9a0f1237843e6d.tar.gz |
Many files:
Merge InnoDB-3.23.50
innobase/btr/btr0btr.c:
Merge InnoDB-3.23.50
innobase/btr/btr0cur.c:
Merge InnoDB-3.23.50
innobase/btr/btr0sea.c:
Merge InnoDB-3.23.50
innobase/buf/buf0buf.c:
Merge InnoDB-3.23.50
innobase/buf/buf0flu.c:
Merge InnoDB-3.23.50
innobase/dict/dict0dict.c:
Merge InnoDB-3.23.50
innobase/dict/dict0load.c:
Merge InnoDB-3.23.50
innobase/fil/fil0fil.c:
Merge InnoDB-3.23.50
innobase/fsp/fsp0fsp.c:
Merge InnoDB-3.23.50
innobase/include/buf0flu.h:
Merge InnoDB-3.23.50
innobase/include/dict0dict.h:
Merge InnoDB-3.23.50
innobase/include/fil0fil.h:
Merge InnoDB-3.23.50
innobase/include/fsp0fsp.h:
Merge InnoDB-3.23.50
innobase/include/log0log.h:
Merge InnoDB-3.23.50
innobase/include/log0recv.h:
Merge InnoDB-3.23.50
innobase/include/mem0mem.h:
Merge InnoDB-3.23.50
innobase/include/os0file.h:
Merge InnoDB-3.23.50
innobase/include/row0mysql.h:
Merge InnoDB-3.23.50
innobase/include/srv0srv.h:
Merge InnoDB-3.23.50
innobase/include/srv0start.h:
Merge InnoDB-3.23.50
innobase/include/trx0sys.h:
Merge InnoDB-3.23.50
innobase/include/ut0byte.h:
Merge InnoDB-3.23.50
innobase/include/ut0rnd.h:
Merge InnoDB-3.23.50
innobase/include/ut0ut.h:
Merge InnoDB-3.23.50
innobase/log/log0log.c:
Merge InnoDB-3.23.50
innobase/log/log0recv.c:
Merge InnoDB-3.23.50
innobase/mem/mem0mem.c:
Merge InnoDB-3.23.50
innobase/os/os0file.c:
Merge InnoDB-3.23.50
innobase/rem/rem0cmp.c:
Merge InnoDB-3.23.50
innobase/row/row0ins.c:
Merge InnoDB-3.23.50
innobase/row/row0mysql.c:
Merge InnoDB-3.23.50
innobase/row/row0sel.c:
Merge InnoDB-3.23.50
innobase/row/row0upd.c:
Merge InnoDB-3.23.50
innobase/srv/srv0srv.c:
Merge InnoDB-3.23.50
innobase/srv/srv0start.c:
Merge InnoDB-3.23.50
innobase/trx/trx0sys.c:
Merge InnoDB-3.23.50
innobase/ut/ut0mem.c:
Merge InnoDB-3.23.50
innobase/ut/ut0ut.c:
Merge InnoDB-3.23.50
sql/ha_innobase.cc:
Merge InnoDB-3.23.50
sql/ha_innobase.h:
Merge InnoDB-3.23.50
Diffstat (limited to 'innobase/ut')
-rw-r--r-- | innobase/ut/ut0mem.c | 1 | ||||
-rw-r--r-- | innobase/ut/ut0ut.c | 77 |
2 files changed, 64 insertions, 14 deletions
diff --git a/innobase/ut/ut0mem.c b/innobase/ut/ut0mem.c index 79351ff120f..a1320e8b5bc 100644 --- a/innobase/ut/ut0mem.c +++ b/innobase/ut/ut0mem.c @@ -121,6 +121,7 @@ ut_malloc( { return(ut_malloc_low(n, TRUE)); } + /************************************************************************** Frees a memory block allocated with ut_malloc. */ diff --git a/innobase/ut/ut0ut.c b/innobase/ut/ut0ut.c index 964d5bca567..7ee32b9a8e2 100644 --- a/innobase/ut/ut0ut.c +++ b/innobase/ut/ut0ut.c @@ -17,6 +17,24 @@ Created 5/11/1994 Heikki Tuuri ibool ut_always_false = FALSE; /************************************************************ +Gets the high 32 bits in a ulint. That is makes a shift >> 32, +but since there seem to be compiler bugs in both gcc and Visual C++, +we do this by a special conversion. */ + +ulint +ut_get_high32( +/*==========*/ + /* out: a >> 32 */ + ulint a) /* in: ulint */ +{ + if (sizeof(ulint) == 4) { + return(0); + } + + return(a >> 32); +} + +/************************************************************ The following function returns a clock time in milliseconds. */ ulint @@ -58,11 +76,11 @@ ut_print_timestamp( FILE* file) /* in: file where to print */ { #ifdef __WIN__ - SYSTEMTIME cal_tm; + SYSTEMTIME cal_tm; - GetLocalTime(&cal_tm); + GetLocalTime(&cal_tm); - fprintf(file,"%02d%02d%02d %2d:%02d:%02d", + fprintf(file,"%02d%02d%02d %2d:%02d:%02d", (int)cal_tm.wYear % 100, (int)cal_tm.wMonth, (int)cal_tm.wDay, @@ -70,23 +88,21 @@ ut_print_timestamp( (int)cal_tm.wMinute, (int)cal_tm.wSecond); #else + struct tm cal_tm; + struct tm* cal_tm_ptr; + time_t tm; - struct tm cal_tm; - struct tm* cal_tm_ptr; - time_t tm; - - time(&tm); + time(&tm); #ifdef HAVE_LOCALTIME_R - localtime_r(&tm, &cal_tm); - cal_tm_ptr = &cal_tm; + localtime_r(&tm, &cal_tm); + cal_tm_ptr = &cal_tm; #else - cal_tm_ptr = localtime(&tm); + cal_tm_ptr = localtime(&tm); #endif - - fprintf(file,"%02d%02d%02d %2d:%02d:%02d", + fprintf(file,"%02d%02d%02d %2d:%02d:%02d", cal_tm_ptr->tm_year % 100, - cal_tm_ptr->tm_mon+1, + cal_tm_ptr->tm_mon + 1, cal_tm_ptr->tm_mday, cal_tm_ptr->tm_hour, cal_tm_ptr->tm_min, @@ -94,6 +110,39 @@ ut_print_timestamp( #endif } +/************************************************************** +Returns current year, month, day. */ + +void +ut_get_year_month_day( +/*==================*/ + ulint* year, /* out: current year */ + ulint* month, /* out: month */ + ulint* day) /* out: day */ +{ +#ifdef __WIN__ + SYSTEMTIME cal_tm; + + GetLocalTime(&cal_tm); + + *year = (ulint)cal_tm.wYear; + *month = (ulint)cal_tm.wMonth; + *day = (ulint)cal_tm.wDay; +#else + struct tm cal_tm; + struct tm* cal_tm_ptr; + time_t tm; + + time(&tm); + + cal_tm_ptr = localtime(&tm); + + *year = (ulint)cal_tm_ptr->tm_year; + *month = (ulint)cal_tm_ptr->tm_mon + 1; + *day = (ulint)cal_tm_ptr->tm_mday; +#endif +} + /***************************************************************** Runs an idle loop on CPU. The argument gives the desired delay in microseconds on 100 MHz Pentium + Visual C++. */ |