enhanced qse_timegm
This commit is contained in:
@ -47,7 +47,7 @@ public:
|
||||
this->alloc = alloc_mem;
|
||||
this->realloc = realloc_mem;
|
||||
this->free = free_mem;
|
||||
this->data = this;
|
||||
this->udd = this;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -88,25 +88,25 @@ protected:
|
||||
/**
|
||||
* a bridge function from the qse_mmgr_t type the allocMem() function.
|
||||
*/
|
||||
static void* alloc_mem (void* data, qse_size_t n) throw ()
|
||||
static void* alloc_mem (void* udd, qse_size_t n) throw ()
|
||||
{
|
||||
return ((Mmgr*)data)->allocMem (n);
|
||||
return ((Mmgr*)udd)->allocMem (n);
|
||||
}
|
||||
|
||||
/**
|
||||
* a bridge function from the qse_mmgr_t type the reallocMem() function.
|
||||
*/
|
||||
static void* realloc_mem (void* data, void* ptr, qse_size_t n) throw ()
|
||||
static void* realloc_mem (void* udd, void* ptr, qse_size_t n) throw ()
|
||||
{
|
||||
return ((Mmgr*)data)->reallocMem (ptr, n);
|
||||
return ((Mmgr*)udd)->reallocMem (ptr, n);
|
||||
}
|
||||
|
||||
/**
|
||||
* a bridge function from the qse_mmgr_t type the freeMem() function.
|
||||
*/
|
||||
static void free_mem (void* data, void* ptr) throw ()
|
||||
static void free_mem (void* udd, void* ptr) throw ()
|
||||
{
|
||||
return ((Mmgr*)data)->freeMem (ptr);
|
||||
return ((Mmgr*)udd)->freeMem (ptr);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: mem.h 75 2009-02-22 14:10:34Z hyunghwan.chung $
|
||||
* $Id: mem.h 186 2009-06-06 13:42:57Z hyunghwan.chung $
|
||||
*
|
||||
Copyright 2006-2009 Chung, Hyung-Hwan.
|
||||
|
||||
@ -30,15 +30,15 @@
|
||||
|
||||
/* allocate a memory block */
|
||||
#define QSE_MMGR_ALLOC(mmgr,size) \
|
||||
((mmgr)->alloc((mmgr)->data,size))
|
||||
((mmgr)->alloc((mmgr)->udd,size))
|
||||
|
||||
/* reallocate a memory block */
|
||||
#define QSE_MMGR_REALLOC(mmgr,ptr,size) \
|
||||
((mmgr)->realloc((mmgr)->data,ptr,size))
|
||||
((mmgr)->realloc((mmgr)->udd,ptr,size))
|
||||
|
||||
/* free a memory block */
|
||||
#define QSE_MMGR_FREE(mmgr,ptr) \
|
||||
((mmgr)->free((mmgr)->data,ptr))
|
||||
((mmgr)->free((mmgr)->udd,ptr))
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: time.h 75 2009-02-22 14:10:34Z hyunghwan.chung $
|
||||
* $Id: time.h 186 2009-06-06 13:42:57Z hyunghwan.chung $
|
||||
*
|
||||
Copyright 2006-2009 Chung, Hyung-Hwan.
|
||||
|
||||
@ -46,7 +46,7 @@
|
||||
#define QSE_NSECS_PER_USEC (1000)
|
||||
#define QSE_USECS_PER_SEC (QSE_USECS_PER_MSEC*QSE_MSECS_PER_SEC)
|
||||
|
||||
#define QSE_IS_LEAPYEAR(year) (!((year)%4) && (((year)%100) || !((year)%400)))
|
||||
#define QSE_IS_LEAPYEAR(year) ((!((year)%4) && ((year)%100)) || !((year)%400))
|
||||
#define QSE_DAYS_PER_YEAR(year) (QSE_IS_LEAPYEAR(year)? 366: 365)
|
||||
|
||||
/* number of milliseconds since the Epoch (00:00:00 UTC, Jan 1, 1970) */
|
||||
@ -93,21 +93,16 @@ int qse_settime (
|
||||
/******/
|
||||
|
||||
|
||||
/****f* Common/qse_gmtime
|
||||
* NAME
|
||||
* qse_gmtime - convert numeric time to broken-down time
|
||||
* SYNOPSIS
|
||||
/**
|
||||
* The qse_gmtime() function converts numeric time to broken-down time.
|
||||
*/
|
||||
int qse_gmtime (
|
||||
qse_ntime_t nt,
|
||||
qse_btime_t* bt
|
||||
);
|
||||
/******/
|
||||
|
||||
/****f* Common/qse_localtime
|
||||
* NAME
|
||||
* qse_localtime - convert numeric time to broken-down time
|
||||
* SYNOPSIS
|
||||
/**
|
||||
* The qse_localtime() converts numeric time to broken-down time
|
||||
*/
|
||||
int qse_localtime (
|
||||
qse_ntime_t nt,
|
||||
@ -115,11 +110,10 @@ int qse_localtime (
|
||||
);
|
||||
/******/
|
||||
|
||||
/****f* Common/qse_timegm
|
||||
* NAME
|
||||
* qse_timegm - convert broken-down time to numeric time
|
||||
*
|
||||
* SYNOPSIS
|
||||
/**
|
||||
* The qse_timegm() converts broken-down time to numeric time. It is the
|
||||
* inverse of qse_gmtime(). It is useful if the broken-down time is in UTC
|
||||
* and the local environment is not.
|
||||
*/
|
||||
int qse_timegm (
|
||||
const qse_btime_t* bt,
|
||||
@ -127,11 +121,9 @@ int qse_timegm (
|
||||
);
|
||||
/******/
|
||||
|
||||
/****f* Common/qse_timelocal
|
||||
* NAME
|
||||
* qse_timelocal - convert broken-down time to numeric time
|
||||
*
|
||||
* SYNOPSIS
|
||||
/**
|
||||
* The qse_timelocal() converts broken-down time to numeric time. It is the
|
||||
* inverse of qse_localtime();
|
||||
*/
|
||||
int qse_timelcoal (
|
||||
const qse_btime_t* bt,
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: macros.h 176 2009-06-02 14:13:50Z hyunghwan.chung $
|
||||
* $Id: macros.h 186 2009-06-06 13:42:57Z hyunghwan.chung $
|
||||
*
|
||||
Copyright 2006-2009 Chung, Hyung-Hwan.
|
||||
|
||||
@ -149,7 +149,7 @@
|
||||
*/
|
||||
#define QSE_MT(txt) (txt)
|
||||
|
||||
#define QSE_WQ_I(val) (L ## #val)
|
||||
#define QSE_WQ_I(val) (L ## QSE_MQ_I(val))
|
||||
#define QSE_WQ(val) QSE_WQ_I(val)
|
||||
#define QSE_WC(ch) ((qse_wchar_t)L ## ch)
|
||||
#define QSE_WS(str) ((const qse_wchar_t*)L ## str)
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: types.h 176 2009-06-02 14:13:50Z hyunghwan.chung $
|
||||
* $Id: types.h 186 2009-06-06 13:42:57Z hyunghwan.chung $
|
||||
*
|
||||
Copyright 2006-2009 Chung, Hyung-Hwan.
|
||||
|
||||
@ -394,21 +394,21 @@ struct qse_mmgr_t
|
||||
* allocate a memory chunk of the size \a n.
|
||||
* @return a pointer to a memory chunk on success, QSE_NULL on failure.
|
||||
*/
|
||||
void* (*alloc) (void* data, qse_size_t n);
|
||||
void* (*alloc) (void* udd, qse_size_t n);
|
||||
/**
|
||||
* resize a memory chunk pointed to by \a ptr to the size \a n.
|
||||
* @return a pointer to a memory chunk on success, QSE_NULL on failure.
|
||||
*/
|
||||
void* (*realloc) (void* data, void* ptr, qse_size_t n);
|
||||
void* (*realloc) (void* udd, void* ptr, qse_size_t n);
|
||||
/**
|
||||
* frees a memory chunk pointed to by \a ptr.
|
||||
*/
|
||||
void (*free) (void* data, void* ptr);
|
||||
void (*free) (void* udd, void* ptr);
|
||||
/**
|
||||
* a pointer to user-defined data passed as the first parameter to
|
||||
* alloc(), realloc(), and free().
|
||||
*/
|
||||
void* data;
|
||||
void* udd;
|
||||
};
|
||||
typedef struct qse_mmgr_t qse_mmgr_t;
|
||||
/******/
|
||||
|
Reference in New Issue
Block a user