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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? date.c

?? 最新的sqlite3.6.2源代碼
?? C
?? 第 1 頁 / 共 2 頁
字號:
/*** 2003 October 31**** The author disclaims copyright to this source code.  In place of** a legal notice, here is a blessing:****    May you do good and not evil.**    May you find forgiveness for yourself and forgive others.**    May you share freely, never taking more than you give.***************************************************************************** This file contains the C functions that implement date and time** functions for SQLite.  **** There is only one exported symbol in this file - the function** sqlite3RegisterDateTimeFunctions() found at the bottom of the file.** All other code has file scope.**** $Id: date.c,v 1.88 2008/08/21 20:21:35 drh Exp $**** SQLite processes all times and dates as Julian Day numbers.  The** dates and times are stored as the number of days since noon** in Greenwich on November 24, 4714 B.C. according to the Gregorian** calendar system. **** 1970-01-01 00:00:00 is JD 2440587.5** 2000-01-01 00:00:00 is JD 2451544.5**** This implemention requires years to be expressed as a 4-digit number** which means that only dates between 0000-01-01 and 9999-12-31 can** be represented, even though julian day numbers allow a much wider** range of dates.**** The Gregorian calendar system is used for all dates and times,** even those that predate the Gregorian calendar.  Historians usually** use the Julian calendar for dates prior to 1582-10-15 and for some** dates afterwards, depending on locale.  Beware of this difference.**** The conversion algorithms are implemented based on descriptions** in the following text:****      Jean Meeus**      Astronomical Algorithms, 2nd Edition, 1998**      ISBM 0-943396-61-1**      Willmann-Bell, Inc**      Richmond, Virginia (USA)*/#include "sqliteInt.h"#include <ctype.h>#include <stdlib.h>#include <assert.h>#include <time.h>#ifndef SQLITE_OMIT_DATETIME_FUNCS/*** On recent Windows platforms, the localtime_s() function is available** as part of the "Secure CRT". It is essentially equivalent to ** localtime_r() available under most POSIX platforms, except that the ** order of the parameters is reversed.**** See http://msdn.microsoft.com/en-us/library/a442x3ye(VS.80).aspx.**** If the user has not indicated to use localtime_r() or localtime_s()** already, check for an MSVC build environment that provides ** localtime_s().*/#if !defined(HAVE_LOCALTIME_R) && !defined(HAVE_LOCALTIME_S) && \     defined(_MSC_VER) && defined(_CRT_INSECURE_DEPRECATE)#define HAVE_LOCALTIME_S 1#endif/*** A structure for holding a single date and time.*/typedef struct DateTime DateTime;struct DateTime {  sqlite3_int64 iJD; /* The julian day number times 86400000 */  int Y, M, D;       /* Year, month, and day */  int h, m;          /* Hour and minutes */  int tz;            /* Timezone offset in minutes */  double s;          /* Seconds */  char validYMD;     /* True if Y,M,D are valid */  char validHMS;     /* True if h,m,s are valid */  char validJD;      /* True if iJD is valid */  char validTZ;      /* True if tz is valid */};/*** Convert zDate into one or more integers.  Additional arguments** come in groups of 5 as follows:****       N       number of digits in the integer**       min     minimum allowed value of the integer**       max     maximum allowed value of the integer**       nextC   first character after the integer**       pVal    where to write the integers value.**** Conversions continue until one with nextC==0 is encountered.** The function returns the number of successful conversions.*/static int getDigits(const char *zDate, ...){  va_list ap;  int val;  int N;  int min;  int max;  int nextC;  int *pVal;  int cnt = 0;  va_start(ap, zDate);  do{    N = va_arg(ap, int);    min = va_arg(ap, int);    max = va_arg(ap, int);    nextC = va_arg(ap, int);    pVal = va_arg(ap, int*);    val = 0;    while( N-- ){      if( !isdigit(*(u8*)zDate) ){        goto end_getDigits;      }      val = val*10 + *zDate - '0';      zDate++;    }    if( val<min || val>max || (nextC!=0 && nextC!=*zDate) ){      goto end_getDigits;    }    *pVal = val;    zDate++;    cnt++;  }while( nextC );end_getDigits:  va_end(ap);  return cnt;}/*** Read text from z[] and convert into a floating point number.  Return** the number of digits converted.*/#define getValue sqlite3AtoF/*** Parse a timezone extension on the end of a date-time.** The extension is of the form:****        (+/-)HH:MM**** Or the "zulu" notation:****        Z**** If the parse is successful, write the number of minutes** of change in p->tz and return 0.  If a parser error occurs,** return non-zero.**** A missing specifier is not considered an error.*/static int parseTimezone(const char *zDate, DateTime *p){  int sgn = 0;  int nHr, nMn;  int c;  while( isspace(*(u8*)zDate) ){ zDate++; }  p->tz = 0;  c = *zDate;  if( c=='-' ){    sgn = -1;  }else if( c=='+' ){    sgn = +1;  }else if( c=='Z' || c=='z' ){    zDate++;    goto zulu_time;  }else{    return c!=0;  }  zDate++;  if( getDigits(zDate, 2, 0, 14, ':', &nHr, 2, 0, 59, 0, &nMn)!=2 ){    return 1;  }  zDate += 5;  p->tz = sgn*(nMn + nHr*60);zulu_time:  while( isspace(*(u8*)zDate) ){ zDate++; }  return *zDate!=0;}/*** Parse times of the form HH:MM or HH:MM:SS or HH:MM:SS.FFFF.** The HH, MM, and SS must each be exactly 2 digits.  The** fractional seconds FFFF can be one or more digits.**** Return 1 if there is a parsing error and 0 on success.*/static int parseHhMmSs(const char *zDate, DateTime *p){  int h, m, s;  double ms = 0.0;  if( getDigits(zDate, 2, 0, 24, ':', &h, 2, 0, 59, 0, &m)!=2 ){    return 1;  }  zDate += 5;  if( *zDate==':' ){    zDate++;    if( getDigits(zDate, 2, 0, 59, 0, &s)!=1 ){      return 1;    }    zDate += 2;    if( *zDate=='.' && isdigit((u8)zDate[1]) ){      double rScale = 1.0;      zDate++;      while( isdigit(*(u8*)zDate) ){        ms = ms*10.0 + *zDate - '0';        rScale *= 10.0;        zDate++;      }      ms /= rScale;    }  }else{    s = 0;  }  p->validJD = 0;  p->validHMS = 1;  p->h = h;  p->m = m;  p->s = s + ms;  if( parseTimezone(zDate, p) ) return 1;  p->validTZ = p->tz!=0;  return 0;}/*** Convert from YYYY-MM-DD HH:MM:SS to julian day.  We always assume** that the YYYY-MM-DD is according to the Gregorian calendar.**** Reference:  Meeus page 61*/static void computeJD(DateTime *p){  int Y, M, D, A, B, X1, X2;  if( p->validJD ) return;  if( p->validYMD ){    Y = p->Y;    M = p->M;    D = p->D;  }else{    Y = 2000;  /* If no YMD specified, assume 2000-Jan-01 */    M = 1;    D = 1;  }  if( M<=2 ){    Y--;    M += 12;  }  A = Y/100;  B = 2 - A + (A/4);  X1 = 365.25*(Y+4716);  X2 = 30.6001*(M+1);  p->iJD = (X1 + X2 + D + B - 1524.5)*86400000;  p->validJD = 1;  if( p->validHMS ){    p->iJD += p->h*3600000 + p->m*60000 + p->s*1000;    if( p->validTZ ){      p->iJD -= p->tz*60000;      p->validYMD = 0;      p->validHMS = 0;      p->validTZ = 0;    }  }}/*** Parse dates of the form****     YYYY-MM-DD HH:MM:SS.FFF**     YYYY-MM-DD HH:MM:SS**     YYYY-MM-DD HH:MM**     YYYY-MM-DD**** Write the result into the DateTime structure and return 0** on success and 1 if the input string is not a well-formed** date.*/static int parseYyyyMmDd(const char *zDate, DateTime *p){  int Y, M, D, neg;  if( zDate[0]=='-' ){    zDate++;    neg = 1;  }else{    neg = 0;  }  if( getDigits(zDate,4,0,9999,'-',&Y,2,1,12,'-',&M,2,1,31,0,&D)!=3 ){    return 1;  }  zDate += 10;  while( isspace(*(u8*)zDate) || 'T'==*(u8*)zDate ){ zDate++; }  if( parseHhMmSs(zDate, p)==0 ){    /* We got the time */  }else if( *zDate==0 ){    p->validHMS = 0;  }else{    return 1;  }  p->validJD = 0;  p->validYMD = 1;  p->Y = neg ? -Y : Y;  p->M = M;  p->D = D;  if( p->validTZ ){    computeJD(p);  }  return 0;}/*** Set the time to the current time reported by the VFS*/static void setDateTimeToCurrent(sqlite3_context *context, DateTime *p){  double r;  sqlite3 *db = sqlite3_context_db_handle(context);  sqlite3OsCurrentTime(db->pVfs, &r);  p->iJD = (sqlite3_int64)(r*86400000.0 + 0.5);  p->validJD = 1;}/*** Attempt to parse the given string into a Julian Day Number.  Return** the number of errors.**** The following are acceptable forms for the input string:****      YYYY-MM-DD HH:MM:SS.FFF  +/-HH:MM**      DDDD.DD **      now**** In the first form, the +/-HH:MM is always optional.  The fractional** seconds extension (the ".FFF") is optional.  The seconds portion** (":SS.FFF") is option.  The year and date can be omitted as long** as there is a time string.  The time string can be omitted as long** as there is a year and date.*/static int parseDateOrTime(  sqlite3_context *context,   const char *zDate,   DateTime *p){  if( parseYyyyMmDd(zDate,p)==0 ){    return 0;  }else if( parseHhMmSs(zDate, p)==0 ){    return 0;  }else if( sqlite3StrICmp(zDate,"now")==0){    setDateTimeToCurrent(context, p);    return 0;  }else if( sqlite3IsNumber(zDate, 0, SQLITE_UTF8) ){    double r;    getValue(zDate, &r);    p->iJD = (sqlite3_int64)(r*86400000.0 + 0.5);    p->validJD = 1;    return 0;  }  return 1;}/*** Compute the Year, Month, and Day from the julian day number.*/static void computeYMD(DateTime *p){  int Z, A, B, C, D, E, X1;  if( p->validYMD ) return;  if( !p->validJD ){    p->Y = 2000;    p->M = 1;    p->D = 1;  }else{    Z = (p->iJD + 43200000)/86400000;    A = (Z - 1867216.25)/36524.25;    A = Z + 1 + A - (A/4);    B = A + 1524;    C = (B - 122.1)/365.25;    D = 365.25*C;    E = (B-D)/30.6001;    X1 = 30.6001*E;    p->D = B - D - X1;    p->M = E<14 ? E-1 : E-13;    p->Y = p->M>2 ? C - 4716 : C - 4715;  }  p->validYMD = 1;}/*** Compute the Hour, Minute, and Seconds from the julian day number.*/static void computeHMS(DateTime *p){  int s;  if( p->validHMS ) return;  computeJD(p);  s = (p->iJD + 43200000) % 86400000;  p->s = s/1000.0;  s = p->s;  p->s -= s;  p->h = s/3600;  s -= p->h*3600;  p->m = s/60;  p->s += s - p->m*60;  p->validHMS = 1;}/*** Compute both YMD and HMS*/static void computeYMD_HMS(DateTime *p){  computeYMD(p);  computeHMS(p);}/*** Clear the YMD and HMS and the TZ*/static void clearYMD_HMS_TZ(DateTime *p){  p->validYMD = 0;  p->validHMS = 0;  p->validTZ = 0;}#ifndef SQLITE_OMIT_LOCALTIME/*** Compute the difference (in milliseconds)** between localtime and UTC (a.k.a. GMT)** for the time value p where p is in UTC.*/static int localtimeOffset(DateTime *p){  DateTime x, y;  time_t t;  x = *p;  computeYMD_HMS(&x);  if( x.Y<1971 || x.Y>=2038 ){    x.Y = 2000;    x.M = 1;    x.D = 1;    x.h = 0;    x.m = 0;    x.s = 0.0;  } else {    int s = x.s + 0.5;    x.s = s;  }  x.tz = 0;  x.validJD = 0;  computeJD(&x);  t = x.iJD/1000 - 2440587.5*86400.0;#ifdef HAVE_LOCALTIME_R  {    struct tm sLocal;    localtime_r(&t, &sLocal);    y.Y = sLocal.tm_year + 1900;    y.M = sLocal.tm_mon + 1;    y.D = sLocal.tm_mday;    y.h = sLocal.tm_hour;    y.m = sLocal.tm_min;    y.s = sLocal.tm_sec;  }#elif defined(HAVE_LOCALTIME_S)  {    struct tm sLocal;    localtime_s(&sLocal, &t);    y.Y = sLocal.tm_year + 1900;    y.M = sLocal.tm_mon + 1;    y.D = sLocal.tm_mday;    y.h = sLocal.tm_hour;    y.m = sLocal.tm_min;    y.s = sLocal.tm_sec;  }#else  {    struct tm *pTm;    sqlite3_mutex_enter(sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER));    pTm = localtime(&t);    y.Y = pTm->tm_year + 1900;    y.M = pTm->tm_mon + 1;    y.D = pTm->tm_mday;    y.h = pTm->tm_hour;    y.m = pTm->tm_min;    y.s = pTm->tm_sec;    sqlite3_mutex_leave(sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER));  }#endif  y.validYMD = 1;  y.validHMS = 1;  y.validJD = 0;  y.validTZ = 0;  computeJD(&y);  return y.iJD - x.iJD;}#endif /* SQLITE_OMIT_LOCALTIME *//*** Process a modifier to a date-time stamp.  The modifiers are** as follows:****     NNN days**     NNN hours**     NNN minutes**     NNN.NNNN seconds**     NNN months**     NNN years**     start of month**     start of year**     start of week**     start of day**     weekday N**     unixepoch**     localtime**     utc**** Return 0 on success and 1 if there is any kind of error.*/static int parseModifier(const char *zMod, DateTime *p){  int rc = 1;  int n;  double r;  char *z, zBuf[30];  z = zBuf;  for(n=0; n<sizeof(zBuf)-1 && zMod[n]; n++){    z[n] = tolower(zMod[n]);  }  z[n] = 0;  switch( z[0] ){#ifndef SQLITE_OMIT_LOCALTIME    case 'l': {      /*    localtime      **      ** Assuming the current time value is UTC (a.k.a. GMT), shift it to      ** show local time.      */      if( strcmp(z, "localtime")==0 ){        computeJD(p);        p->iJD += localtimeOffset(p);        clearYMD_HMS_TZ(p);

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
久久―日本道色综合久久| 激情深爱一区二区| 91麻豆免费看| 亚洲激情一二三区| 欧美日韩亚洲综合一区二区三区| 亚洲综合色自拍一区| 欧美色手机在线观看| 日韩精品一区第一页| 欧美成人在线直播| 国产乱人伦精品一区二区在线观看| 国产丝袜美腿一区二区三区| 99在线精品观看| 一区二区三区资源| 欧美精品tushy高清| 久久精品二区亚洲w码| 国产无遮挡一区二区三区毛片日本| 9i看片成人免费高清| 亚洲va国产天堂va久久en| 日韩欧美一级在线播放| 国产不卡高清在线观看视频| 亚洲精品乱码久久久久| 欧美日韩的一区二区| 国产在线视频精品一区| 成人免费视频在线观看| 欧美日韩免费一区二区三区视频 | 国产精品久久久久一区二区三区| 国产91丝袜在线18| 亚洲一区二区三区不卡国产欧美| 亚洲精品一区二区三区在线观看| 99精品久久久久久| 日本美女一区二区| 国产精品久久久久国产精品日日| 欧美日韩国产三级| 成人在线一区二区三区| 亚洲国产你懂的| 久久精品一区二区三区四区| 91麻豆免费观看| 国产精品一区久久久久| 亚洲福利一区二区三区| 久久精品人人做人人综合| 91激情在线视频| 懂色av中文一区二区三区| 午夜视黄欧洲亚洲| 中文字幕亚洲在| 精品国产欧美一区二区| 在线视频国内一区二区| 国产suv精品一区二区6| 日韩精品高清不卡| 亚洲女女做受ⅹxx高潮| 久久久久久久一区| 制服丝袜一区二区三区| 色婷婷狠狠综合| 成人免费观看视频| 久久99精品国产.久久久久久| 亚洲观看高清完整版在线观看| 中文字幕欧美激情| 717成人午夜免费福利电影| 91猫先生在线| 9i在线看片成人免费| 国产电影一区在线| 美女mm1313爽爽久久久蜜臀| 日韩精品一卡二卡三卡四卡无卡| 亚洲男帅同性gay1069| 亚洲国产电影在线观看| 久久综合久久鬼色| 日韩亚洲欧美高清| 91精品国产色综合久久| 欧美性xxxxxx少妇| 在线精品亚洲一区二区不卡| 91丨九色porny丨蝌蚪| 成人免费视频一区| 国产69精品久久久久777| 国内精品视频一区二区三区八戒| 日韩成人免费电影| 天天综合网天天综合色| 夜色激情一区二区| 亚洲黄色小视频| 一区二区三区欧美激情| 伊人性伊人情综合网| 专区另类欧美日韩| 亚洲你懂的在线视频| 亚洲精品国产视频| 亚洲精品免费在线| 亚洲国产日韩a在线播放性色| 亚洲一区二区三区影院| 亚洲v精品v日韩v欧美v专区| 日韩精品1区2区3区| 蜜桃精品视频在线| 久热成人在线视频| 狠狠色丁香婷综合久久| 国产精品99久久久久久久vr| 成人免费毛片片v| 一本大道久久a久久精品综合| 91国产成人在线| 欧美一区二区日韩| 欧美精品一区视频| 久久精品夜色噜噜亚洲a∨| 中文字幕欧美日本乱码一线二线| 一区在线中文字幕| 亚洲一区视频在线观看视频| 日韩av不卡在线观看| 九一九一国产精品| 丁香天五香天堂综合| 91小视频在线免费看| 欧美自拍偷拍午夜视频| 日韩欧美在线不卡| 国产日产欧美一区二区视频| 亚洲欧美日韩人成在线播放| 舔着乳尖日韩一区| 国产在线精品不卡| 91丨国产丨九色丨pron| 91麻豆精品国产91久久久久久 | 亚洲综合久久av| 麻豆久久一区二区| 成人性生交大片免费看在线播放| av不卡免费电影| 91精品国产乱码久久蜜臀| 久久免费精品国产久精品久久久久| 国产精品国产成人国产三级| 亚洲精品视频一区二区| 美女一区二区在线观看| 99re这里都是精品| 欧美日本高清视频在线观看| 国产性做久久久久久| 亚洲国产一区二区视频| 国产精品一区二区三区网站| 欧美日韩免费视频| 中文字幕制服丝袜成人av| 日韩福利电影在线| 一本久久a久久精品亚洲| 欧美成人一区二区三区| 亚洲一区自拍偷拍| 国产精品影视网| 在线成人高清不卡| 日韩毛片精品高清免费| 精品一区二区三区欧美| 欧美日韩黄色一区二区| 中文字幕一区二区视频| 韩国精品免费视频| 欧美疯狂做受xxxx富婆| 亚洲欧美激情在线| 3d成人动漫网站| 国产精品伦理一区二区| 精品中文字幕一区二区| 欧美综合色免费| 久久久久久**毛片大全| 91精品国产欧美一区二区成人| 亚洲欧美偷拍卡通变态| 九九九久久久精品| 99久久99久久免费精品蜜臀| 久久久久久亚洲综合影院红桃 | 在线不卡的av| 国产精品成人一区二区艾草| 六月丁香婷婷久久| 欧美日韩成人在线| 日韩毛片高清在线播放| 国产河南妇女毛片精品久久久| 欧美精三区欧美精三区| 国产免费观看久久| 日韩精品国产精品| 欧美在线观看视频一区二区| 国产视频一区二区三区在线观看| 蜜桃精品视频在线| 欧美日韩成人综合在线一区二区 | 欧美成人午夜电影| 亚洲成av人片在www色猫咪| 成人高清伦理免费影院在线观看| 中文字幕乱码日本亚洲一区二区| 久久99久久精品欧美| 欧美日本高清视频在线观看| 亚洲一区影音先锋| 欧美色图12p| 一区二区日韩av| 91黄色小视频| 国产精品色婷婷久久58| 成人av午夜电影| 国产精品毛片高清在线完整版| 国产一区二区三区黄视频 | 在线看日韩精品电影| 亚洲视频免费观看| 色婷婷久久99综合精品jk白丝 | 日本一区二区三级电影在线观看| 国产九色精品成人porny| 欧美精品一区二区蜜臀亚洲| 久久综合综合久久综合| 欧美大片一区二区| 美国av一区二区| 国产精品免费视频网站| 国产一区二区不卡在线 | 久久青草欧美一区二区三区| 天堂精品中文字幕在线| 精品成人私密视频| 国产综合色在线| 亚洲国产精品av| 色视频成人在线观看免| 亚洲一区二区黄色| 7777精品久久久大香线蕉| 蜜桃久久精品一区二区| 国产精品久久久久久久久久久免费看 | 中文字幕乱码一区二区免费|