Annotation of embedaddon/php/ext/date/lib/timelib_structs.h, revision 1.1

1.1     ! misho       1: /*
        !             2:    +----------------------------------------------------------------------+
        !             3:    | PHP Version 5                                                        |
        !             4:    +----------------------------------------------------------------------+
        !             5:    | Copyright (c) 1997-2010 The PHP Group                                |
        !             6:    +----------------------------------------------------------------------+
        !             7:    | This source file is subject to version 3.01 of the PHP license,      |
        !             8:    | that is bundled with this package in the file LICENSE, and is        |
        !             9:    | available through the world-wide-web at the following url:           |
        !            10:    | http://www.php.net/license/3_01.txt                                  |
        !            11:    | If you did not receive a copy of the PHP license and are unable to   |
        !            12:    | obtain it through the world-wide-web, please send a note to          |
        !            13:    | license@php.net so we can mail you a copy immediately.               |
        !            14:    +----------------------------------------------------------------------+
        !            15:    | Authors: Derick Rethans <derick@derickrethans.nl>                    |
        !            16:    +----------------------------------------------------------------------+
        !            17:  */
        !            18: 
        !            19: /* $Id: timelib_structs.h 307038 2011-01-03 19:24:04Z scottmac $ */
        !            20: 
        !            21: #ifndef __TIMELIB_STRUCTS_H__
        !            22: #define __TIMELIB_STRUCTS_H__
        !            23: 
        !            24: #include "timelib_config.h"
        !            25: 
        !            26: #ifdef HAVE_SYS_TYPES_H
        !            27: #include <sys/types.h>
        !            28: #endif
        !            29: 
        !            30: #if defined(HAVE_INTTYPES_H)
        !            31: #include <inttypes.h>
        !            32: #elif defined(HAVE_STDINT_H)
        !            33: #include <stdint.h>
        !            34: #endif
        !            35: 
        !            36: #ifdef PHP_WIN32
        !            37: /* TODO: Remove these hacks/defs once we have the int definitions in main/ 
        !            38:         rathen than in each 2nd extension and win32/ */
        !            39: # include "win32/php_stdint.h"
        !            40: #else
        !            41: # ifndef HAVE_INT32_T
        !            42: #  if SIZEOF_INT == 4
        !            43: typedef int int32_t;
        !            44: #  elif SIZEOF_LONG == 4
        !            45: typedef long int int32_t;
        !            46: #  endif
        !            47: # endif
        !            48: 
        !            49: # ifndef HAVE_UINT32_T
        !            50: #  if SIZEOF_INT == 4
        !            51: typedef unsigned int uint32_t;
        !            52: #  elif SIZEOF_LONG == 4
        !            53: typedef unsigned long int uint32_t;
        !            54: #  endif
        !            55: # endif
        !            56: #endif
        !            57: 
        !            58: #include <stdio.h>
        !            59: 
        !            60: #ifdef HAVE_STDLIB_H
        !            61: #include <stdlib.h>
        !            62: #endif
        !            63: 
        !            64: #ifdef HAVE_STRING_H
        !            65: #include <string.h>
        !            66: #else
        !            67: #include <strings.h>
        !            68: #endif
        !            69: 
        !            70: #if defined(_MSC_VER)
        !            71: typedef uint64_t timelib_ull;
        !            72: typedef int64_t timelib_sll;
        !            73: # define TIMELIB_LL_CONST(n) n ## i64
        !            74: #else
        !            75: typedef unsigned long long timelib_ull;
        !            76: typedef signed long long timelib_sll;
        !            77: # define TIMELIB_LL_CONST(n) n ## ll
        !            78: #endif
        !            79: 
        !            80: typedef struct ttinfo
        !            81: {
        !            82:        int32_t      offset;
        !            83:        int          isdst;
        !            84:        unsigned int abbr_idx;
        !            85: 
        !            86:        unsigned int isstdcnt;
        !            87:        unsigned int isgmtcnt;
        !            88: } ttinfo;
        !            89: 
        !            90: typedef struct tlinfo
        !            91: {
        !            92:        int32_t  trans;
        !            93:        int32_t  offset;
        !            94: } tlinfo;
        !            95: 
        !            96: typedef struct tlocinfo
        !            97: {
        !            98:        char country_code[3];
        !            99:        double latitude;
        !           100:        double longitude;
        !           101:        char *comments;
        !           102: } tlocinfo;
        !           103: 
        !           104: typedef struct timelib_tzinfo
        !           105: {
        !           106:        char    *name;
        !           107:        uint32_t ttisgmtcnt;
        !           108:        uint32_t ttisstdcnt;
        !           109:        uint32_t leapcnt;
        !           110:        uint32_t timecnt;
        !           111:        uint32_t typecnt;
        !           112:        uint32_t charcnt;
        !           113: 
        !           114:        int32_t *trans;
        !           115:        unsigned char *trans_idx;
        !           116: 
        !           117:        ttinfo  *type;
        !           118:        char    *timezone_abbr;
        !           119: 
        !           120:        tlinfo  *leap_times;
        !           121:        unsigned char bc;
        !           122:        tlocinfo location;
        !           123: } timelib_tzinfo;
        !           124: 
        !           125: typedef struct timelib_special {
        !           126:        unsigned int type;
        !           127:        timelib_sll amount;
        !           128: } timelib_special;
        !           129: 
        !           130: typedef struct timelib_rel_time {
        !           131:        timelib_sll y, m, d; /* Years, Months and Days */
        !           132:        timelib_sll h, i, s; /* Hours, mInutes and Seconds */
        !           133: 
        !           134:        int weekday; /* Stores the day in 'next monday' */
        !           135:        int weekday_behavior; /* 0: the current day should *not* be counted when advancing forwards; 1: the current day *should* be counted */
        !           136: 
        !           137:        int first_last_day_of;
        !           138:        int invert; /* Whether the difference should be inverted */
        !           139:        timelib_sll days; /* Contains the number of *days*, instead of Y-M-D differences */
        !           140: 
        !           141:        timelib_special  special;
        !           142:        unsigned int   have_weekday_relative, have_special_relative;
        !           143: } timelib_rel_time;
        !           144: 
        !           145: typedef struct timelib_time_offset {
        !           146:        int32_t      offset;
        !           147:        unsigned int leap_secs;
        !           148:        unsigned int is_dst;
        !           149:        char        *abbr;
        !           150:        timelib_sll  transistion_time;
        !           151: } timelib_time_offset;
        !           152: 
        !           153: typedef struct timelib_time {
        !           154:        timelib_sll      y, m, d;     /* Year, Month, Day */
        !           155:        timelib_sll      h, i, s;     /* Hour, mInute, Second */
        !           156:        double           f;           /* Fraction */
        !           157:        int              z;           /* GMT offset in minutes */
        !           158:        char            *tz_abbr;     /* Timezone abbreviation (display only) */
        !           159:        timelib_tzinfo  *tz_info;     /* Timezone structure */
        !           160:        signed int       dst;         /* Flag if we were parsing a DST zone */
        !           161:        timelib_rel_time relative;
        !           162: 
        !           163:        timelib_sll      sse;         /* Seconds since epoch */
        !           164: 
        !           165:        unsigned int   have_time, have_date, have_zone, have_relative, have_weeknr_day;
        !           166: 
        !           167:        unsigned int   sse_uptodate; /* !0 if the sse member is up to date with the date/time members */
        !           168:        unsigned int   tim_uptodate; /* !0 if the date/time members are up to date with the sse member */
        !           169:        unsigned int   is_localtime; /*  1 if the current struct represents localtime, 0 if it is in GMT */
        !           170:        unsigned int   zone_type;    /*  1 time offset,
        !           171:                                      *  3 TimeZone identifier,
        !           172:                                      *  2 TimeZone abbreviation */
        !           173: } timelib_time;
        !           174: 
        !           175: typedef struct timelib_error_message {
        !           176:        int         position;
        !           177:        char        character;
        !           178:        char       *message;
        !           179: } timelib_error_message;
        !           180: 
        !           181: typedef struct timelib_error_container {
        !           182:        int                           warning_count;
        !           183:        struct timelib_error_message *warning_messages;
        !           184:        int                           error_count;
        !           185:        struct timelib_error_message *error_messages;
        !           186: } timelib_error_container;
        !           187: 
        !           188: typedef struct _timelib_tz_lookup_table {
        !           189:        char       *name;
        !           190:        int         type;
        !           191:        float       gmtoffset;
        !           192:        char       *full_tz_name;
        !           193: } timelib_tz_lookup_table;
        !           194: 
        !           195: typedef struct _timelib_tzdb_index_entry {
        !           196:        char *id;
        !           197:        unsigned int pos;
        !           198: } timelib_tzdb_index_entry;
        !           199: 
        !           200: typedef struct _timelib_tzdb {
        !           201:        char                           *version;
        !           202:        int                             index_size;
        !           203:        const timelib_tzdb_index_entry *index;
        !           204:        const unsigned char            *data;
        !           205: } timelib_tzdb;
        !           206: 
        !           207: #define TIMELIB_ZONETYPE_OFFSET 1
        !           208: #define TIMELIB_ZONETYPE_ABBR   2
        !           209: #define TIMELIB_ZONETYPE_ID     3
        !           210: 
        !           211: #define SECS_PER_ERA   TIMELIB_LL_CONST(12622780800)
        !           212: #define SECS_PER_DAY   86400
        !           213: #define DAYS_PER_YEAR    365
        !           214: #define DAYS_PER_LYEAR   366
        !           215: /* 400*365 days + 97 leap days */
        !           216: #define DAYS_PER_LYEAR_PERIOD 146097
        !           217: #define YEARS_PER_LYEAR_PERIOD 400
        !           218: 
        !           219: #define timelib_is_leap(y) ((y) % 4 == 0 && ((y) % 100 != 0 || (y) % 400 == 0))
        !           220: 
        !           221: #define TIMELIB_DEBUG(s)  if (0) { s }
        !           222: 
        !           223: #endif

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>