亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? tzset.c

?? C標(biāo)準(zhǔn)庫源代碼,能提高對C的理解,不錯的哦
?? C
?? 第 1 頁 / 共 2 頁
字號:
/***
*tzset.c - set timezone information and see if we're in daylight time
*
*       Copyright (c) 1985-1998, Microsoft Corporation. All rights reserved.
*
*Purpose:
*       defines _tzset() - set timezone and daylight saving time vars
*
*******************************************************************************/

#ifdef _WIN32


#include <cruntime.h>
#include <ctype.h>
#include <ctime.h>
#include <time.h>
#include <stdlib.h>
#include <internal.h>
#include <mtdll.h>
#include <windows.h>
#include <setlocal.h>
#include <string.h>
#include <dbgint.h>


/*
 * Number of milliseconds in one day
 */
#define DAY_MILLISEC    (24L * 60L * 60L * 1000L)

/*
 * The macro below is valid for years between 1901 and 2099, which easily
 * includes all years representable by the current implementation of time_t.
 */
#define IS_LEAP_YEAR(year)  ( (year & 3) == 0 )

/*
 * Pointer to a saved copy of the TZ value obtained in the previous call
 * to tzset() set (if any).
 */
static char * lastTZ = NULL;

/*
 * Flag indicating that time zone information came from GetTimeZoneInformation
 * API call.
 */
static int tzapiused;

static TIME_ZONE_INFORMATION tzinfo;

/*
 * Structure used to represent DST transition date/times.
 */
typedef struct {
        int  yr;        /* year of interest */
        int  yd;        /* day of year */
        long ms;        /* milli-seconds in the day */
        } transitiondate;

/*
 * DST start and end structs.
 */
static transitiondate dststart = { -1, 0, 0L };
static transitiondate dstend   = { -1, 0, 0L };

static int __cdecl _isindst_lk(struct tm *);



/***
*void tzset() - sets timezone information and calc if in daylight time
*
*Purpose:
*       Sets the timezone information from the TZ environment variable
*       and then sets _timezone, _daylight, and _tzname. If we're in daylight
*       time is automatically calculated.
*
*Entry:
*       None, reads TZ environment variable.
*
*Exit:
*       sets _daylight, _timezone, and _tzname global vars, no return value
*
*Exceptions:
*
*******************************************************************************/


#ifdef _MT
static void __cdecl _tzset_lk(void);
#else  /* _MT */
#define _tzset_lk _tzset
#endif  /* _MT */

void __cdecl __tzset(void)
{
        static int first_time = 0;

        if ( !first_time ) {

            _mlock( _TIME_LOCK );

            if ( !first_time ) {
                _tzset_lk();
                first_time++;
            }

            _munlock(_TIME_LOCK );

        }
}


#ifdef _MT
void __cdecl _tzset (
        void
        )
{
        _mlock( _TIME_LOCK );

        _tzset_lk();

        _munlock( _TIME_LOCK );
}


static void __cdecl _tzset_lk (

#else  /* _MT */

void __cdecl _tzset (

#endif  /* _MT */

        void
        )
{
        char *TZ;
        int defused;
        int negdiff = 0;

        _mlock(_ENV_LOCK);

        /*
         * Clear the flag indicated whether GetTimeZoneInformation was used.
         */
        tzapiused = 0;

        /*
         * Set year fields of dststart and dstend structures to -1 to ensure
         * they are recomputed as after this
         */
        dststart.yr = dstend.yr = -1;

        /*
         * Fetch the value of the TZ environment variable.
         */
        if ( (TZ = _getenv_lk("TZ")) == NULL ) {

            /*
             * There is no TZ environment variable, try to use the time zone
             * information from the system.
             */

            _munlock(_ENV_LOCK);

            if ( GetTimeZoneInformation( &tzinfo ) != 0xFFFFFFFF ) {
                /*
                 * Note that the API was used.
                 */
                tzapiused = 1;

                /*
                 * Derive _timezone value from Bias and StandardBias fields.
                 */
                _timezone = tzinfo.Bias * 60L;

                if ( tzinfo.StandardDate.wMonth != 0 )
                    _timezone += (tzinfo.StandardBias * 60L);

                /*
                 * Check to see if there is a daylight time bias. Since the
                 * StandardBias has been added into _timezone, it must be
                 * compensated for in the value computed for _dstbias.
                 */
                if ( (tzinfo.DaylightDate.wMonth != 0) &&
                     (tzinfo.DaylightBias != 0) )
                {
                    _daylight = 1;
                    _dstbias = (tzinfo.DaylightBias - tzinfo.StandardBias) *
                               60L;
                }
                else {
                        _daylight = 0;

                    /*
                     * Set daylight bias to 0 because GetTimeZoneInformation
                     * may return TIME_ZONE_ID_DAYLIGHT even though there is
                     * no DST (in NT 3.51, just turn off the automatic DST
                     * adjust in the control panel)!
                     */
                    _dstbias = 0;
                }

                /*
                 * Try to grab the name strings for both the time zone and the
                 * daylight zone. Note the wide character strings in tzinfo
                 * must be converted to multibyte characters strings. The
                 * locale codepage, __lc_codepage, is used for this. Note that
                 * if setlocale() with LC_ALL or LC_CTYPE has not been called,
                 * then __lc_codepage will be 0 (_CLOCALECP), which is CP_ACP
                 * (which means use the host's default ANSI codepage).
                 */
                if ( (WideCharToMultiByte( __lc_codepage,
                                           WC_COMPOSITECHECK |
                                            WC_SEPCHARS,
                                           tzinfo.StandardName,
                                           -1,
                                           _tzname[0],
                                           63,
                                           NULL,
                                           &defused ) != 0) &&
                     (!defused) )
                    _tzname[0][63] = '\0';
                else
                    _tzname[0][0] = '\0';

                if ( (WideCharToMultiByte( __lc_codepage,
                                           WC_COMPOSITECHECK |
                                            WC_SEPCHARS,
                                           tzinfo.DaylightName,
                                           -1,
                                           _tzname[1],
                                           63,
                                           NULL,
                                           &defused ) != 0) &&
                     (!defused) )
                    _tzname[1][63] = '\0';
                else
                    _tzname[1][0] = '\0';

            }

            /*
             * Time zone information is unavailable, just return.
             */
            return;
        }


        if ( (*TZ == '\0') || ((lastTZ != NULL) && (strcmp(TZ, lastTZ) == 0)) )
        {
            /*
             * Either TZ is NULL, pointing to '\0', or is the unchanged
             * from a earlier call (to this function). In any case, there
             * is no work to do, so just return
             */
            _munlock(_ENV_LOCK);
            return;
        }

        /*
         * Update lastTZ
         */
        _free_crt(lastTZ);

        if ((lastTZ = _malloc_crt(strlen(TZ)+1)) == NULL)
        {
            _munlock(_ENV_LOCK);
            return;
        }
        strcpy(lastTZ, TZ);

        _munlock(_ENV_LOCK);

        /*
         * Process TZ value and update _tzname, _timezone and _daylight.
         */

        strncpy(_tzname[0], TZ, 3);
        _tzname[0][3] = '\0';

        /*
         * time difference is of the form:
         *
         *      [+|-]hh[:mm[:ss]]
         *
         * check minus sign first.
         */
        if ( *(TZ += 3) == '-' ) {
            negdiff++;
            TZ++;
        }

        /*
         * process, then skip over, the hours
         */
        _timezone = atol(TZ) * 3600L;

        while ( (*TZ == '+') || ((*TZ >= '0') && (*TZ <= '9')) ) TZ++;

        /*
         * check if minutes were specified
         */
        if ( *TZ == ':' ) {
            /*
             * process, then skip over, the minutes
             */
            _timezone += atol(++TZ) * 60L;
            while ( (*TZ >= '0') && (*TZ <= '9') ) TZ++;

            /*
             * check if seconds were specified
             */
            if ( *TZ == ':' ) {
                /*
                 * process, then skip over, the seconds
                 */
                _timezone += atol(++TZ);
                while ( (*TZ >= '0') && (*TZ <= '9') ) TZ++;
            }
        }

        if ( negdiff )
            _timezone = -_timezone;

        /*
         * finally, check for a DST zone suffix
         */
        if ( _daylight = *TZ ) {
            strncpy(_tzname[1], TZ, 3);
            _tzname[1][3] = '\0';
        }
        else
            *_tzname[1] = '\0';

}

/***
*static void cvtdate( trantype, datetype, year, month, week, dayofweek,
*                     date, hour, min, second, millisec ) - convert
*       transition date format
*
*Purpose:
*       Convert the format of a transition date specification to a value of
*       a transitiondate structure.
*
*Entry:
*       int trantype    - 1, if it is the start of DST
*                         0, if is the end of DST (in which case the date is
*                            is a DST date)
*       int datetype    - 1, if a day-in-month format is specified.
*                         0, if an absolute date is specified.
*       int year        - year for which the date is being converted (70 ==
*                         1970)
*       int month       - month (0 == January)
*       int week        - week of month, if datetype == 1 (note that 5== last
*                         week of month),
*                         0, otherwise.
*       int dayofweek   - day of week (0 == Sunday), if datetype == 1.
*                         0, otherwise.
*       int date        - date of month (1 - 31)
*       int hour        - hours (0 - 23)
*       int min         - minutes (0 - 59)
*       int sec         - seconds (0 - 59)
*       int msec        - milliseconds (0 - 999)
*
*Exit:
*       dststart or dstend is filled in with the converted date.
*
*******************************************************************************/

static void __cdecl cvtdate (
        int trantype,
        int datetype,
        int year,
        int month,
        int week,
        int dayofweek,
        int date,
        int hour,
        int min,
        int sec,
        int msec
        )
{
        int yearday;
        int monthdow;

        if ( datetype == 1 ) {

            /*
             * Transition day specified in day-in-month format.
             */

            /*
             * Figure the year-day of the start of the month.
             */
            yearday = 1 + (IS_LEAP_YEAR(year) ? _lpdays[month - 1] :
                      _days[month - 1]);

            /*
             * Figure the day of the week of the start of the month.
             */
            monthdow = (yearday + ((year - 70) * 365) + ((year - 1) >> 2) -
                        _LEAP_YEAR_ADJUST + _BASE_DOW) % 7;

            /*
             * Figure the year-day of the transition date
             */
            if ( monthdow < dayofweek )
                yearday += (dayofweek - monthdow) + (week - 1) * 7;
            else
                yearday += (dayofweek - monthdow) + week * 7;

            /*
             * May have to adjust the calculation above if week == 5 (meaning
             * the last instance of the day in the month). Check if year falls
             * beyond after month and adjust accordingly.
             */
            if ( (week == 5) &&
                 (yearday > (IS_LEAP_YEAR(year) ? _lpdays[month] :
                             _days[month])) )
            {
                yearday -= 7;
            }
        }
        else {
            /*
             * Transition day specified as an absolute day
             */
            yearday = IS_LEAP_YEAR(year) ? _lpdays[month - 1] :
                      _days[month - 1];

            yearday += date;
        }

        if ( trantype == 1 ) {
            /*
             * Converted date was for the start of DST
             */
            dststart.yd = yearday;
            dststart.ms = (long)msec +
                          (1000L * (sec + 60L * (min + 60L * hour)));
            /*
             * Set year field of dststart so that unnecessary calls to
             * cvtdate() may be avoided.
             */
            dststart.yr = year;
        }
        else {
            /*
             * Converted date was for the end of DST
             */
            dstend.yd = yearday;
            dstend.ms = (long)msec +
                              (1000L * (sec + 60L * (min + 60L * hour)));
            /*
             * The converted date is still a DST date. Must convert to a
             * standard (local) date while being careful the millisecond field
             * does not overflow or underflow.
             */
            if ( (dstend.ms += (_dstbias * 1000L)) < 0 ) {
                dstend.ms += DAY_MILLISEC;
                dstend.yd--;
            }

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲成人免费视| 狠狠色丁香久久婷婷综合_中| 久久国产婷婷国产香蕉| 7777精品伊人久久久大香线蕉经典版下载| 玉米视频成人免费看| 一本大道综合伊人精品热热| 亚洲柠檬福利资源导航| 91久久免费观看| 亚洲成人一区二区| 日韩欧美国产一二三区| 国产成人综合在线观看| 亚洲同性gay激情无套| 91麻豆国产在线观看| 午夜婷婷国产麻豆精品| 欧美性色综合网| 色婷婷久久99综合精品jk白丝| 日韩午夜在线观看| 国产精品1024久久| 综合电影一区二区三区| 欧美军同video69gay| 国产一区久久久| 综合av第一页| 日韩一区二区三区视频| 成人av一区二区三区| 天天爽夜夜爽夜夜爽精品视频| 欧美zozozo| 一本到不卡精品视频在线观看| 奇米精品一区二区三区四区| 久久精品一二三| 欧美日韩在线电影| 国产综合久久久久久久久久久久| 国产精品久久久久9999吃药| 欧美色爱综合网| 国产91精品露脸国语对白| 一区二区三区日韩在线观看| 欧美成人精品福利| 一本色道**综合亚洲精品蜜桃冫| 蜜臀精品久久久久久蜜臀| 中文字幕日韩av资源站| 日韩欧美国产一区在线观看| 一本大道av一区二区在线播放| 美日韩一区二区三区| 亚洲图片激情小说| 久久欧美中文字幕| 欧美日韩激情一区二区三区| 国产成人精品亚洲777人妖| 亚洲福利一二三区| 国产精品久久午夜| 日韩你懂的在线播放| 欧美在线三级电影| 成人午夜视频免费看| 久久99国产精品麻豆| 亚洲第一主播视频| 亚洲视频电影在线| 欧美国产日韩精品免费观看| 日韩免费成人网| 91麻豆精品国产91久久久 | 老司机午夜精品| 一区二区三区中文字幕在线观看| 精品国产一区二区三区久久久蜜月| 色综合久久久久综合体桃花网| 日韩制服丝袜av| 最新热久久免费视频| 欧美亚洲精品一区| 99久久精品99国产精品| 亚洲无线码一区二区三区| 国产欧美一区二区精品久导航| 在线综合视频播放| 精品视频在线免费观看| 国产在线播精品第三| 日本欧美肥老太交大片| 亚洲国产精品影院| 综合久久久久久久| ●精品国产综合乱码久久久久| 国产欧美精品一区二区色综合朱莉| 日韩免费性生活视频播放| 欧美一区二区三区视频| 日韩三级中文字幕| 日韩免费在线观看| wwwwww.欧美系列| 精品成人一区二区三区四区| 日韩欧美的一区| 精品国产成人系列| 日韩精品一区二区三区在线播放| 91精品国产综合久久香蕉麻豆| 欧美日韩www| 91精品在线一区二区| 欧美大度的电影原声| 欧美大片在线观看一区二区| 精品剧情在线观看| 国产日韩av一区| 欧美高清在线一区| 国产精品久久看| 亚洲综合在线观看视频| 亚洲国产一区二区a毛片| 日韩国产欧美在线播放| 久久精品国产99| 国产成人免费在线| 97久久精品人人澡人人爽| 欧美三级欧美一级| 日韩一区国产二区欧美三区| 精品成人a区在线观看| 欧美激情一二三区| 一区二区三区中文字幕电影| 婷婷成人激情在线网| 国产在线精品一区二区三区不卡| 成人黄色av电影| 欧美午夜一区二区| 精品福利一二区| 中文字幕av一区 二区| 亚洲综合在线观看视频| 麻豆成人免费电影| 成人av在线电影| 欧美三级日韩三级| 久久久不卡网国产精品二区| 国产精品国产三级国产有无不卡| 亚洲已满18点击进入久久| 蜜臀av性久久久久蜜臀aⅴ四虎| 国产精品一区二区视频| 欧美性大战xxxxx久久久| 久久久不卡网国产精品二区| 一区二区三区精品| 国产不卡免费视频| 欧美日韩一区二区三区在线| 久久久噜噜噜久久中文字幕色伊伊| 成人欧美一区二区三区小说| 日本va欧美va精品发布| jlzzjlzz欧美大全| 日韩精品专区在线影院重磅| 《视频一区视频二区| 精品综合免费视频观看| 欧美综合久久久| 国产日本亚洲高清| 日本va欧美va瓶| 欧美在线小视频| 欧美激情综合网| 韩日av一区二区| 欧美一区三区二区| 亚洲免费色视频| 国产精品一级在线| 91精品国产乱| 亚洲黄色免费电影| 成人动漫在线一区| 久久久国产午夜精品| 日韩成人精品在线| 91高清视频免费看| 国产精品网曝门| 国产一区二区三区在线观看精品| 欧美又粗又大又爽| 国产精品久久午夜| 成人免费看的视频| 久久这里只有精品6| 免费在线成人网| 欧美精品自拍偷拍动漫精品| 亚洲欧美综合色| 成人精品视频一区二区三区| 日韩一级视频免费观看在线| 亚洲国产综合在线| 91福利视频网站| 亚洲美女偷拍久久| 一本色道久久加勒比精品| 日韩一区日韩二区| 91麻豆精品视频| 亚洲特级片在线| www.亚洲色图| 亚洲天堂精品在线观看| 成a人片亚洲日本久久| 国产精品免费aⅴ片在线观看| 国产91丝袜在线18| 亚洲国产精品ⅴa在线观看| 精品午夜一区二区三区在线观看 | 成人一区在线观看| 久久亚洲综合色| 国产精品亚洲专一区二区三区| 日韩亚洲欧美在线观看| 蜜桃免费网站一区二区三区| 91精品国产全国免费观看| 免费人成网站在线观看欧美高清| 在线不卡一区二区| 九九在线精品视频| 久久久美女艺术照精彩视频福利播放 | 色噜噜狠狠色综合欧洲selulu| 欧美日韩日日骚| 99天天综合性| 亚洲欧洲日韩一区二区三区| 99r国产精品| 一区二区三区免费看视频| 欧美日韩和欧美的一区二区| 天天操天天色综合| 久久日一线二线三线suv| 国产一区二区三区在线观看免费视频 | 色一情一伦一子一伦一区| 一区二区三区四区不卡视频| 欧美日本一区二区三区| 捆绑调教一区二区三区| 久久久av毛片精品| 色婷婷综合久久久久中文| 日韩成人午夜精品| 国产欧美一区二区在线观看| 91国偷自产一区二区三区成为亚洲经典 |