diff options
| author | Lorry Tar Creator <lorry-tar-importer@baserock.org> | 2015-02-17 17:25:57 +0000 |
|---|---|---|
| committer | <> | 2015-03-17 16:26:24 +0000 |
| commit | 780b92ada9afcf1d58085a83a0b9e6bc982203d1 (patch) | |
| tree | 598f8b9fa431b228d29897e798de4ac0c1d3d970 /src/os_windows/ce_gmtime.c | |
| parent | 7a2660ba9cc2dc03a69ddfcfd95369395cc87444 (diff) | |
| download | berkeleydb-master.tar.gz | |
Diffstat (limited to 'src/os_windows/ce_gmtime.c')
| -rw-r--r-- | src/os_windows/ce_gmtime.c | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/src/os_windows/ce_gmtime.c b/src/os_windows/ce_gmtime.c new file mode 100644 index 00000000..55605c89 --- /dev/null +++ b/src/os_windows/ce_gmtime.c @@ -0,0 +1,58 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 2012, 2015 Oracle and/or its affiliates. All rights reserved. + * + * $Id$ + */ + +#include "db_config.h" + +#include "db_int.h" + +/* + * __ce_gmtime -- + * gmtime implementation on WinCE. + * + * PUBLIC: #ifdef DB_WINCE + * PUBLIC: struct tm * __ce_gmtime __P((const time_t *)); + * PUBLIC: #endif + */ + +struct tm * +__ce_gmtime(timer) + const time_t *timer; +{ + static struct tm br_time; + struct tm *timep; + time_t ti; + unsigned long dayclock, dayno; + int year; + + timep = &br_time; + ti = *timer; + dayclock = (unsigned long)ti % SECSPERDAY; + dayno = (unsigned long)ti / SECSPERDAY; + year = TM_YEAR_EPOCH; + + timep->tm_sec = dayclock % 60; + timep->tm_min = (dayclock % 3600) / 60; + timep->tm_hour = dayclock / 3600; + /* day 0 was a thursday */ + timep->tm_wday = (dayno + 4) % 7; + while (dayno >= year_lengths[isleap(year)]) { + dayno -= year_lengths[isleap(year)]; + year++; + } + timep->tm_year = year - TM_YEAR_BASE; + timep->tm_yday = dayno; + timep->tm_mon = 0; + while (dayno >= mon_lengths[isleap(year)][timep->tm_mon]) { + dayno -= mon_lengths[isleap(year)][timep->tm_mon]; + timep->tm_mon++; + } + timep->tm_mday = dayno + 1; + timep->tm_isdst = 0; + + return timep; +} |
