time64.c File Reference

#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <time.h>
#include <errno.h>
#include "time64.h"
#include "time64_limits.h"
Include dependency graph for time64.c:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Defines

#define CHEAT_DAYS   (1199145600 / 24 / 60 / 60)
#define CHEAT_YEARS   108
#define days_in_gregorian_cycle   ((365 * 400) + 100 - 4 + 1)
#define IS_LEAP(n)   ((!(((n) + 1900) % 400) || (!(((n) + 1900) % 4) && (((n) + 1900) % 100))) != 0)
#define MAX_SAFE_YEAR   2037
#define MIN_SAFE_YEAR   1971
#define SHOULD_USE_SYSTEM_GMTIME(a)   (0)
#define SHOULD_USE_SYSTEM_LOCALTIME(a)   (0)
#define SOLAR_CYCLE_LENGTH   28
#define TIME64_TRACE(format)   ((void)0)
#define TIME64_TRACE1(format, var1)   ((void)0)
#define TIME64_TRACE2(format, var1, var2)   ((void)0)
#define TIME64_TRACE3(format, var1, var2, var3)   ((void)0)
#define WRAP(a, b, m)   ((a) = ((a) < 0 ) ? ((b)--, (a) + (m)) : (a))

Functions

char * asctime64 (const struct TM *date)
char * asctime64_r (const struct TM *date, char *result)
static int check_tm (struct TM *tm)
int cmp_date (const struct TM *left, const struct tm *right)
void copy_TM64_to_tm (const struct TM *src, struct tm *dest)
void copy_tm_to_TM64 (const struct tm *src, struct TM *dest)
char * ctime64 (const Time64_T *time)
char * ctime64_r (const Time64_T *time, char *result)
static Year cycle_offset (Year year)
int date_in_safe_range (const struct TM *date, const struct tm *min, const struct tm *max)
struct tm * fake_gmtime_r (const time_t *time, struct tm *result)
struct tm * fake_localtime_r (const time_t *time, struct tm *result)
struct TM * gmtime64 (const Time64_T *time)
struct TM * gmtime64_r (const Time64_T *in_time, struct TM *p)
static int is_exception_century (Year year)
struct TM * localtime64 (const Time64_T *time)
struct TM * localtime64_r (const Time64_T *time, struct TM *local_tm)
Time64_T mktime64 (const struct TM *input_date)
static int safe_year (const Year year)
static Time64_T seconds_between_years (Year left_year, Year right_year)
Time64_T timegm64 (const struct TM *date)
Time64_T timelocal64 (const struct TM *date)
int valid_tm_mon (const struct TM *date)
int valid_tm_wday (const struct TM *date)

Variables

static const int days_in_month [2][12]
static const int dow_year_start [SOLAR_CYCLE_LENGTH]
static const int julian_days_by_month [2][12]
static const int length_of_year [2] = { 365, 366 }
static char mon_name [12][4]
static const int safe_years_high [SOLAR_CYCLE_LENGTH]
static const int safe_years_low [SOLAR_CYCLE_LENGTH]
static const Time64_T seconds_in_gregorian_cycle = days_in_gregorian_cycle * 60LL * 60LL * 24LL
static struct TM Static_Return_Date
static char Static_Return_String [35]
static char wday_name [7][4]
static const Year years_in_gregorian_cycle = 400

Define Documentation

#define CHEAT_DAYS   (1199145600 / 24 / 60 / 60)

Definition at line 128 of file time64.c.

#define CHEAT_YEARS   108

Definition at line 129 of file time64.c.

#define days_in_gregorian_cycle   ((365 * 400) + 100 - 4 + 1)

Definition at line 80 of file time64.c.

#define IS_LEAP (  )     ((!(((n) + 1900) % 400) || (!(((n) + 1900) % 4) && (((n) + 1900) % 100))) != 0)

Definition at line 131 of file time64.c.

#define MAX_SAFE_YEAR   2037

Definition at line 84 of file time64.c.

#define MIN_SAFE_YEAR   1971

Definition at line 85 of file time64.c.

#define SHOULD_USE_SYSTEM_GMTIME (  )     (0)

Definition at line 149 of file time64.c.

#define SHOULD_USE_SYSTEM_LOCALTIME (  )     (0)

Definition at line 140 of file time64.c.

#define SOLAR_CYCLE_LENGTH   28

Definition at line 88 of file time64.c.

#define TIME64_TRACE ( format   )     ((void)0)

Definition at line 159 of file time64.c.

#define TIME64_TRACE1 ( format,
var1   )     ((void)0)

Definition at line 160 of file time64.c.

#define TIME64_TRACE2 ( format,
var1,
var2   )     ((void)0)

Definition at line 161 of file time64.c.

#define TIME64_TRACE3 ( format,
var1,
var2,
var3   )     ((void)0)

Definition at line 162 of file time64.c.

#define WRAP ( a,
b,
 )     ((a) = ((a) < 0 ) ? ((b)--, (a) + (m)) : (a))

Definition at line 132 of file time64.c.


Function Documentation

char* asctime64 ( const struct TM *  date  ) 

Definition at line 816 of file time64.c.

char* asctime64_r ( const struct TM *  date,
char *  result 
)

Definition at line 781 of file time64.c.

static int check_tm ( struct TM *  tm  )  [static]

Definition at line 279 of file time64.c.

int cmp_date ( const struct TM *  left,
const struct tm *  right 
)

Definition at line 179 of file time64.c.

void copy_TM64_to_tm ( const struct TM *  src,
struct tm *  dest 
)

Definition at line 427 of file time64.c.

void copy_tm_to_TM64 ( const struct tm *  src,
struct TM *  dest 
)

Definition at line 395 of file time64.c.

char* ctime64 ( const Time64_T time  ) 

Definition at line 820 of file time64.c.

char* ctime64_r ( const Time64_T time,
char *  result 
)

Definition at line 798 of file time64.c.

static Year cycle_offset ( Year  year  )  [static]

Definition at line 315 of file time64.c.

int date_in_safe_range ( const struct TM *  date,
const struct tm *  min,
const struct tm *  max 
)

Definition at line 217 of file time64.c.

struct tm* fake_gmtime_r ( const time_t *  time,
struct tm *  result 
) [read]

Definition at line 477 of file time64.c.

struct tm* fake_localtime_r ( const time_t *  time,
struct tm *  result 
) [read]

Definition at line 460 of file time64.c.

struct TM* gmtime64 ( const Time64_T time  )  [read]

Definition at line 812 of file time64.c.

struct TM* gmtime64_r ( const Time64_T in_time,
struct TM *  p 
) [read]

Definition at line 549 of file time64.c.

static int is_exception_century ( Year  year  )  [static]

Definition at line 166 of file time64.c.

struct TM* localtime64 ( const Time64_T time  )  [read]

Definition at line 807 of file time64.c.

struct TM* localtime64_r ( const Time64_T time,
struct TM *  local_tm 
) [read]

Definition at line 676 of file time64.c.

Time64_T mktime64 ( const struct TM *  input_date  ) 

Definition at line 518 of file time64.c.

static int safe_year ( const Year  year  )  [static]

Definition at line 350 of file time64.c.

static Time64_T seconds_between_years ( Year  left_year,
Year  right_year 
) [static]

Definition at line 493 of file time64.c.

Time64_T timegm64 ( const struct TM *  date  ) 

Definition at line 232 of file time64.c.

Time64_T timelocal64 ( const struct TM *  date  ) 

Definition at line 544 of file time64.c.

int valid_tm_mon ( const struct TM *  date  ) 

Definition at line 773 of file time64.c.

int valid_tm_wday ( const struct TM *  date  ) 

Definition at line 766 of file time64.c.


Variable Documentation

const int days_in_month[2][12] [static]
Initial value:
 {
    {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31},
    {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31},
}

Definition at line 57 of file time64.c.

const int dow_year_start[SOLAR_CYCLE_LENGTH] [static]
Initial value:
 {
    5, 0, 1, 2,     
    3, 5, 6, 0,     
    1, 3, 4, 5,     
    6, 1, 2, 3,     
    4, 6, 0, 1,     
    2, 4, 5, 6,     
    0, 2, 3, 4      
}

Definition at line 113 of file time64.c.

const int julian_days_by_month[2][12] [static]
Initial value:
 {
    {0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334},
    {0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335},
}

Definition at line 62 of file time64.c.

const int length_of_year[2] = { 365, 366 } [static]

Definition at line 76 of file time64.c.

char mon_name[12][4] [static]
Initial value:
 {
    "Jan", "Feb", "Mar", "Apr", "May", "Jun",
    "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
}

Definition at line 71 of file time64.c.

const int safe_years_high[SOLAR_CYCLE_LENGTH] [static]
Initial value:
 {
    2016, 2017, 2018, 2019,
    2020, 2021, 2022, 2023,
    2024, 2025, 2026, 2027,
    2028, 2029, 2030, 2031,
    2032, 2033, 2034, 2035,
    2036, 2037, 2010, 2011,
    2012, 2013, 2014, 2015
}

Definition at line 91 of file time64.c.

const int safe_years_low[SOLAR_CYCLE_LENGTH] [static]
Initial value:
 {
    1996, 1997, 1998, 1971,
    1972, 1973, 1974, 1975,
    1976, 1977, 1978, 1979,
    1980, 1981, 1982, 1983,
    1984, 1985, 1986, 1987,
    1988, 1989, 1990, 1991,
    1992, 1993, 1994, 1995,
}

Definition at line 102 of file time64.c.

const Time64_T seconds_in_gregorian_cycle = days_in_gregorian_cycle * 60LL * 60LL * 24LL [static]

Definition at line 81 of file time64.c.

struct TM Static_Return_Date [static]

Definition at line 54 of file time64.c.

char Static_Return_String[35] [static]

Definition at line 55 of file time64.c.

char wday_name[7][4] [static]
Initial value:
 {
    "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"
}

Definition at line 67 of file time64.c.

const Year years_in_gregorian_cycle = 400 [static]

Definition at line 79 of file time64.c.

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines


pymongo
Author(s): Bhaskara Marthi
autogenerated on Fri Jan 11 10:09:04 2013