1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

Implemented UTC_TIME, UTC_DATE and UTC_TIMESTAMP functions (WL#345)

This commit is contained in:
dlenev@dlenev.mshome
2003-08-11 23:43:01 +04:00
parent a60acfcfe0
commit 921ac8af8b
11 changed files with 260 additions and 58 deletions

View File

@ -133,10 +133,13 @@ int my_sigwait(const sigset_t *set,int *sig)
/* localtime_r for SCO 3.2V4.2 */
#ifndef HAVE_LOCALTIME_R
#if !defined(HAVE_LOCALTIME_R) || !defined(HAVE_GMTIME_R)
extern pthread_mutex_t LOCK_localtime_r;
#endif
#if !defined(HAVE_LOCALTIME_R)
struct tm *localtime_r(const time_t *clock, struct tm *res)
{
struct tm *tmp;
@ -148,6 +151,22 @@ struct tm *localtime_r(const time_t *clock, struct tm *res)
}
#endif
#if !defined(HAVE_GMTIME_R)
/*
Reentrant version of standard gmtime() function.
Needed on some systems which don't implement it.
*/
struct tm *gmtime_r(const time_t *clock, struct tm *res)
{
struct tm *tmp;
pthread_mutex_lock(&LOCK_localtime_r);
tmp= gmtime(clock);
*res= *tmp;
pthread_mutex_unlock(&LOCK_localtime_r);
return res;
}
#endif
/****************************************************************************
** Replacement of sigwait if the system doesn't have one (like BSDI 3.0)