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

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

?? datemath.cpp

?? linux下開源瀏覽器WebKit的源碼,市面上的很多商用瀏覽器都是移植自WebKit
?? CPP
?? 第 1 頁 / 共 2 頁
字號:
/* * Copyright (C) 1999-2000 Harri Porten (porten@kde.org) * Copyright (C) 2006, 2007 Apple Inc. All rights reserved. *  * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA * * Alternatively, the contents of this file may be used under the terms * of either the Mozilla Public License Version 1.1, found at * http://www.mozilla.org/MPL/ (the "MPL") or the GNU General Public * License Version 2.0, found at http://www.fsf.org/copyleft/gpl.html * (the "GPL"), in which case the provisions of the MPL or the GPL are * applicable instead of those above.  If you wish to allow use of your * version of this file only under the terms of one of those two * licenses (the MPL or the GPL) and not to allow others to use your * version of this file under the LGPL, indicate your decision by * deletingthe provisions above and replace them with the notice and * other provisions required by the MPL or the GPL, as the case may be. * If you do not delete the provisions above, a recipient may use your * version of this file under any of the LGPL, the MPL or the GPL. */#include "config.h"#include "DateMath.h"#include "JSNumberCell.h"#include <math.h>#include <stdint.h>#include <time.h>#include <wtf/ASCIICType.h>#include <wtf/Assertions.h>#include <wtf/CurrentTime.h>#include <wtf/MathExtras.h>#include <wtf/StringExtras.h>#if HAVE(ERRNO_H)#include <errno.h>#endif#if PLATFORM(DARWIN)#include <notify.h>#endif#if HAVE(SYS_TIME_H)#include <sys/time.h>#endif#if HAVE(SYS_TIMEB_H)#include <sys/timeb.h>#endif#if HAVE(STRINGS_H)#include <strings.h>#endifusing namespace WTF;namespace JSC {/* Constants */static const double minutesPerDay = 24.0 * 60.0;static const double secondsPerDay = 24.0 * 60.0 * 60.0;static const double secondsPerYear = 24.0 * 60.0 * 60.0 * 365.0;static const double usecPerSec = 1000000.0;static const double maxUnixTime = 2145859200.0; // 12/31/2037// Day of year for the first day of each month, where index 0 is January, and day 0 is January 1.// First for non-leap years, then for leap years.static const int firstDayOfMonth[2][12] = {    {0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334},    {0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335}};static inline bool isLeapYear(int year){    if (year % 4 != 0)        return false;    if (year % 400 == 0)        return true;    if (year % 100 == 0)        return false;    return true;}static inline int daysInYear(int year){    return 365 + isLeapYear(year);}static inline double daysFrom1970ToYear(int year){    // The Gregorian Calendar rules for leap years:    // Every fourth year is a leap year.  2004, 2008, and 2012 are leap years.    // However, every hundredth year is not a leap year.  1900 and 2100 are not leap years.    // Every four hundred years, there's a leap year after all.  2000 and 2400 are leap years.    static const int leapDaysBefore1971By4Rule = 1970 / 4;    static const int excludedLeapDaysBefore1971By100Rule = 1970 / 100;    static const int leapDaysBefore1971By400Rule = 1970 / 400;    const double yearMinusOne = year - 1;    const double yearsToAddBy4Rule = floor(yearMinusOne / 4.0) - leapDaysBefore1971By4Rule;    const double yearsToExcludeBy100Rule = floor(yearMinusOne / 100.0) - excludedLeapDaysBefore1971By100Rule;    const double yearsToAddBy400Rule = floor(yearMinusOne / 400.0) - leapDaysBefore1971By400Rule;    return 365.0 * (year - 1970) + yearsToAddBy4Rule - yearsToExcludeBy100Rule + yearsToAddBy400Rule;}static inline double msToDays(double ms){    return floor(ms / msPerDay);}static inline int msToYear(double ms){    int approxYear = static_cast<int>(floor(ms / (msPerDay * 365.2425)) + 1970);    double msFromApproxYearTo1970 = msPerDay * daysFrom1970ToYear(approxYear);    if (msFromApproxYearTo1970 > ms)        return approxYear - 1;    if (msFromApproxYearTo1970 + msPerDay * daysInYear(approxYear) <= ms)        return approxYear + 1;    return approxYear;}static inline int dayInYear(double ms, int year){    return static_cast<int>(msToDays(ms) - daysFrom1970ToYear(year));}static inline double msToMilliseconds(double ms){    double result = fmod(ms, msPerDay);    if (result < 0)        result += msPerDay;    return result;}// 0: Sunday, 1: Monday, etc.static inline int msToWeekDay(double ms){    int wd = (static_cast<int>(msToDays(ms)) + 4) % 7;    if (wd < 0)        wd += 7;    return wd;}static inline int msToSeconds(double ms){    double result = fmod(floor(ms / msPerSecond), secondsPerMinute);    if (result < 0)        result += secondsPerMinute;    return static_cast<int>(result);}static inline int msToMinutes(double ms){    double result = fmod(floor(ms / msPerMinute), minutesPerHour);    if (result < 0)        result += minutesPerHour;    return static_cast<int>(result);}static inline int msToHours(double ms){    double result = fmod(floor(ms/msPerHour), hoursPerDay);    if (result < 0)        result += hoursPerDay;    return static_cast<int>(result);}static inline int monthFromDayInYear(int dayInYear, bool leapYear){    const int d = dayInYear;    int step;    if (d < (step = 31))        return 0;    step += (leapYear ? 29 : 28);    if (d < step)        return 1;    if (d < (step += 31))        return 2;    if (d < (step += 30))        return 3;    if (d < (step += 31))        return 4;    if (d < (step += 30))        return 5;    if (d < (step += 31))        return 6;    if (d < (step += 31))        return 7;    if (d < (step += 30))        return 8;    if (d < (step += 31))        return 9;    if (d < (step += 30))        return 10;    return 11;}static inline bool checkMonth(int dayInYear, int& startDayOfThisMonth, int& startDayOfNextMonth, int daysInThisMonth){    startDayOfThisMonth = startDayOfNextMonth;    startDayOfNextMonth += daysInThisMonth;    return (dayInYear <= startDayOfNextMonth);}static inline int dayInMonthFromDayInYear(int dayInYear, bool leapYear){    const int d = dayInYear;    int step;    int next = 30;    if (d <= next)        return d + 1;    const int daysInFeb = (leapYear ? 29 : 28);    if (checkMonth(d, step, next, daysInFeb))        return d - step;    if (checkMonth(d, step, next, 31))        return d - step;    if (checkMonth(d, step, next, 30))        return d - step;    if (checkMonth(d, step, next, 31))        return d - step;    if (checkMonth(d, step, next, 30))        return d - step;    if (checkMonth(d, step, next, 31))        return d - step;    if (checkMonth(d, step, next, 31))        return d - step;    if (checkMonth(d, step, next, 30))        return d - step;    if (checkMonth(d, step, next, 31))        return d - step;    if (checkMonth(d, step, next, 30))        return d - step;    step = next;    return d - step;}static inline int monthToDayInYear(int month, bool isLeapYear){    return firstDayOfMonth[isLeapYear][month];}static inline double timeToMS(double hour, double min, double sec, double ms){    return (((hour * minutesPerHour + min) * secondsPerMinute + sec) * msPerSecond + ms);}static int dateToDayInYear(int year, int month, int day){    year += month / 12;    month %= 12;    if (month < 0) {        month += 12;        --year;    }    int yearday = static_cast<int>(floor(daysFrom1970ToYear(year)));    int monthday = monthToDayInYear(month, isLeapYear(year));    return yearday + monthday + day - 1;}double getCurrentUTCTime(){    return floor(getCurrentUTCTimeWithMicroseconds());}// Returns current time in milliseconds since 1 Jan 1970.double getCurrentUTCTimeWithMicroseconds(){    return currentTime() * 1000.0; }void getLocalTime(const time_t* localTime, struct tm* localTM){#if COMPILER(MSVC7) || COMPILER(MINGW) || PLATFORM(WIN_CE)    *localTM = *localtime(localTime);#elif COMPILER(MSVC)    localtime_s(localTM, localTime);#else    localtime_r(localTime, localTM);#endif}// There is a hard limit at 2038 that we currently do not have a workaround// for (rdar://problem/5052975).static inline int maximumYearForDST(){    return 2037;}static inline int minimumYearForDST(){    // Because of the 2038 issue (see maximumYearForDST) if the current year is    // greater than the max year minus 27 (2010), we want to use the max year    // minus 27 instead, to ensure there is a range of 28 years that all years    // can map to.    return std::min(msToYear(getCurrentUTCTime()), maximumYearForDST() - 27) ;}/* * Find an equivalent year for the one given, where equivalence is deterined by * the two years having the same leapness and the first day of the year, falling * on the same day of the week. * * This function returns a year between this current year and 2037, however this * function will potentially return incorrect results if the current year is after * 2010, (rdar://problem/5052975), if the year passed in is before 1900 or after * 2100, (rdar://problem/5055038). */int equivalentYearForDST(int year){    // It is ok if the cached year is not the current year as long as the rules    // for DST did not change between the two years; if they did the app would need    // to be restarted.    static int minYear = minimumYearForDST();    int maxYear = maximumYearForDST();    int difference;    if (year > maxYear)        difference = minYear - year;    else if (year < minYear)        difference = maxYear - year;    else        return year;    int quotient = difference / 28;    int product = (quotient) * 28;    year += product;    ASSERT((year >= minYear && year <= maxYear) || (product - year == static_cast<int>(NaN)));    return year;}static int32_t calculateUTCOffset(){    tm localt;    memset(&localt, 0, sizeof(localt));     // get the difference between this time zone and UTC on Jan 01, 2000 12:00:00 AM    localt.tm_mday = 1;    localt.tm_year = 100;    time_t utcOffset = 946684800 - mktime(&localt);    return static_cast<int32_t>(utcOffset * 1000);}#if PLATFORM(DARWIN)static int32_t s_cachedUTCOffset; // In milliseconds. An assumption here is that access to an int32_t variable is atomic on platforms that take this code path.static bool s_haveCachedUTCOffset;static int s_notificationToken;#endif/* * Get the difference in milliseconds between this time zone and UTC (GMT) * NOT including DST. */double getUTCOffset(){#if PLATFORM(DARWIN)    if (s_haveCachedUTCOffset) {        int notified;        uint32_t status = notify_check(s_notificationToken, &notified);        if (status == NOTIFY_STATUS_OK && !notified)            return s_cachedUTCOffset;    }#endif    int32_t utcOffset = calculateUTCOffset();#if PLATFORM(DARWIN)    // Theoretically, it is possible that several threads will be executing this code at once, in which case we will have a race condition,    // and a newer value may be overwritten. In practice, time zones don't change that often.    s_cachedUTCOffset = utcOffset;#endif    return utcOffset;}/* * Get the DST offset for the time passed in.  Takes * seconds (not milliseconds) and cannot handle dates before 1970 * on some OS' */static double getDSTOffsetSimple(double localTimeSeconds, double utcOffset){    if (localTimeSeconds > maxUnixTime)        localTimeSeconds = maxUnixTime;    else if (localTimeSeconds < 0) // Go ahead a day to make localtime work (does not work with 0)        localTimeSeconds += secondsPerDay;    //input is UTC so we have to shift back to local time to determine DST thus the + getUTCOffset()    double offsetTime = (localTimeSeconds * msPerSecond) + utcOffset;    // Offset from UTC but doesn't include DST obviously    int offsetHour =  msToHours(offsetTime);    int offsetMinute =  msToMinutes(offsetTime);    // FIXME: time_t has a potential problem in 2038    time_t localTime = static_cast<time_t>(localTimeSeconds);    tm localTM;    getLocalTime(&localTime, &localTM);    double diff = ((localTM.tm_hour - offsetHour) * secondsPerHour) + ((localTM.tm_min - offsetMinute) * 60);    if (diff < 0)        diff += secondsPerDay;    return (diff * msPerSecond);}// Get the DST offset, given a time in UTCstatic double getDSTOffset(double ms, double utcOffset){    // On Mac OS X, the call to localtime (see getDSTOffsetSimple) will return historically accurate    // DST information (e.g. New Zealand did not have DST from 1946 to 1974) however the JavaScript    // standard explicitly dictates that historical information should not be considered when    // determining DST. For this reason we shift away from years that localtime can handle but would    // return historically accurate information.    int year = msToYear(ms);    int equivalentYear = equivalentYearForDST(year);    if (year != equivalentYear) {        bool leapYear = isLeapYear(year);        int dayInYearLocal = dayInYear(ms, year);        int dayInMonth = dayInMonthFromDayInYear(dayInYearLocal, leapYear);        int month = monthFromDayInYear(dayInYearLocal, leapYear);        int day = dateToDayInYear(equivalentYear, month, dayInMonth);        ms = (day * msPerDay) + msToMilliseconds(ms);    }    return getDSTOffsetSimple(ms / msPerSecond, utcOffset);}double gregorianDateTimeToMS(const GregorianDateTime& t, double milliSeconds, bool inputIsUTC){    int day = dateToDayInYear(t.year + 1900, t.month, t.monthDay);    double ms = timeToMS(t.hour, t.minute, t.second, milliSeconds);    double result = (day * msPerDay) + ms;    if (!inputIsUTC) { // convert to UTC        double utcOffset = getUTCOffset();        result -= utcOffset;

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
麻豆精品视频在线| 亚洲精品乱码久久久久久久久| 日韩电影免费在线看| 欧美日韩国产免费一区二区| 午夜精品久久久久影视| 91麻豆精品国产91久久久久久久久| 午夜电影一区二区三区| 日韩欧美久久一区| 国产高清不卡一区二区| 亚洲欧美日韩国产综合在线| 日本久久精品电影| 视频一区二区三区中文字幕| 亚洲精品一区二区三区精华液| 国产精品1区2区3区在线观看| 日本一二三不卡| 91黄色激情网站| 蜜桃视频在线观看一区二区| 欧美国产精品中文字幕| 在线观看91精品国产入口| 日本中文字幕一区二区有限公司| 日韩欧美自拍偷拍| 国产mv日韩mv欧美| 一区二区三区欧美激情| 精品国产91九色蝌蚪| 成人国产一区二区三区精品| 亚洲成人动漫在线免费观看| 久久综合久久久久88| 91免费视频网| 国产自产v一区二区三区c| 国产精品久久久久影院老司 | 人人超碰91尤物精品国产| 久久嫩草精品久久久久| 91高清视频在线| 国模大尺度一区二区三区| 亚洲黄色免费电影| 2022国产精品视频| 欧美午夜精品久久久久久超碰| 国产一区二区按摩在线观看| 亚洲一区在线观看免费| 国产欧美精品一区二区三区四区 | 亚洲素人一区二区| 日韩欧美激情一区| 色婷婷av一区二区三区大白胸| 精彩视频一区二区| 一区二区在线观看av| 国产午夜精品一区二区三区视频 | 成人免费毛片高清视频| 日韩在线一区二区| 综合电影一区二区三区| 久久男人中文字幕资源站| 制服视频三区第一页精品| 91首页免费视频| 国产精品亚洲一区二区三区在线| 日韩高清不卡一区二区三区| 亚洲婷婷国产精品电影人久久| 国产欧美综合在线| 精品国产免费人成在线观看| 7777精品伊人久久久大香线蕉的 | 在线电影欧美成精品| 99re66热这里只有精品3直播| 国产成人午夜精品影院观看视频| 美女视频免费一区| 五月综合激情网| 亚洲国产cao| 一区二区欧美视频| 亚洲美女免费在线| 最新国产精品久久精品| 国产婷婷色一区二区三区四区| 欧美精品一区二区蜜臀亚洲| 欧美成人精品二区三区99精品| 欧美喷水一区二区| 制服丝袜在线91| 欧美日韩黄色一区二区| 欧美日韩一区二区电影| 欧美在线观看禁18| 在线观看视频91| 欧美在线三级电影| 欧美日韩免费视频| 欧美精品久久久久久久多人混战| 欧美日韩国产不卡| 欧美精三区欧美精三区| 欧美高清视频不卡网| 777奇米成人网| 欧美精品一区二区三区在线播放| 日韩欧美亚洲国产精品字幕久久久| 日韩限制级电影在线观看| 欧美一区二区三区的| 欧美大片在线观看一区二区| 精品国产乱码久久久久久牛牛| 久久综合九色欧美综合狠狠 | 欧美一区二区三区在线观看 | 久久99精品久久久久久| 国产一区在线精品| 成人av在线一区二区三区| 99国产一区二区三精品乱码| 色视频欧美一区二区三区| 色噜噜狠狠色综合欧洲selulu| 欧美日韩激情在线| 亚洲精品一区二区三区99| 中文字幕一区二区三区色视频| 亚洲免费在线观看视频| 美国三级日本三级久久99| 一本大道久久a久久综合| 久久精品国产第一区二区三区| 韩国成人福利片在线播放| 成人一区二区在线观看| 91在线观看一区二区| 91丨porny丨中文| 欧美军同video69gay| 久久久久久久一区| 亚洲桃色在线一区| 麻豆成人久久精品二区三区红| 国产不卡视频一区二区三区| 日本久久电影网| 精品国产一区二区三区久久久蜜月| 亚洲国产精品传媒在线观看| 亚洲国产欧美日韩另类综合| 国内精品久久久久影院薰衣草| 成人视屏免费看| 欧美一级艳片视频免费观看| 国产精品美女久久久久久久久 | 欧美一区二区视频在线观看2022| 日本一二三不卡| 视频一区二区三区在线| 国产剧情一区在线| 欧美日韩精品专区| 国产精品麻豆网站| 久久综合综合久久综合| 色天使色偷偷av一区二区| 久久久www成人免费毛片麻豆 | 久久精品久久精品| 色综合久久久久久久久| 精品国产网站在线观看| 亚洲五月六月丁香激情| 成人午夜碰碰视频| 日韩一区二区三区四区| 亚洲影视在线观看| 国产91丝袜在线播放九色| 欧美一级片免费看| 亚洲精品菠萝久久久久久久| 久久成人免费日本黄色| 欧美在线999| 国产精品视频一二| 国产一区在线精品| 日韩欧美一二三四区| 亚洲国产三级在线| 色欧美片视频在线观看| 欧美极品aⅴ影院| 国产在线精品一区二区| 欧美一级欧美三级| 亚洲成av人片在线| 99热这里都是精品| 国产精品女上位| 国产精品一卡二卡| 久久久久久久久久久久久夜| 免费国产亚洲视频| 日韩一级大片在线| 美国欧美日韩国产在线播放| 91精品一区二区三区久久久久久| 亚洲一区二区三区四区在线 | 国产一区二区三区国产| 日韩美女主播在线视频一区二区三区| 亚洲高清免费观看| 在线观看一区二区视频| 一区二区三区免费在线观看| 91福利在线免费观看| 亚洲男同性恋视频| 91国偷自产一区二区使用方法| 亚洲靠逼com| 欧美色中文字幕| 亚洲成人动漫在线免费观看| 7777精品伊人久久久大香线蕉经典版下载| 亚洲成人在线免费| 欧美高清视频在线高清观看mv色露露十八| 亚洲无线码一区二区三区| 欧美日韩在线免费视频| 中文字幕一区二区三区四区| 一本色道久久综合亚洲精品按摩| 一区二区中文字幕在线| 94-欧美-setu| 亚洲一区二区三区自拍| 欧美日韩国产bt| 久久国产精品免费| 国产亚洲精品bt天堂精选| 国产精品99久久久久| 综合久久久久久| 欧美日韩一区二区三区四区| 久久成人精品无人区| 国产视频亚洲色图| 91同城在线观看| 亚洲国产另类精品专区| 这里只有精品99re| 国产一区二区看久久| 中文字幕成人网| 欧美日韩在线三级| 久久国产视频网| 国产精品电影院| 欧美日韩国产欧美日美国产精品| 国产曰批免费观看久久久| 亚洲人妖av一区二区|