--- parser3/src/classes/date.C 2004/02/19 15:38:00 1.65 +++ parser3/src/classes/date.C 2005/08/26 12:36:58 1.72 @@ -1,11 +1,11 @@ /** @file Parser: @b date parser class. - Copyright (c) 2001-2004 ArtLebedev Group (http://www.artlebedev.com) + Copyright (c) 2001-2005 ArtLebedev Group (http://www.artlebedev.com) Author: Alexandr Petrosian (http://paf.design.ru) */ -static const char * const IDENT_DATE_C="$Date: 2004/02/19 15:38:00 $"; +static const char * const IDENT_DATE_C="$Date: 2005/08/26 12:36:58 $"; #include "classes.h" #include "pa_vmethod_frame.h" @@ -19,7 +19,7 @@ static const char * const IDENT_DATE_C=" class MDate: public Methoded { public: // VStateless_class - Value* create_new_value(Pool&) { return new VDate(0); } + Value* create_new_value(Pool&, HashStringValue&) { return new VDate(0); } public: MDate(); @@ -79,7 +79,7 @@ static int to_tm_year(int iyear) { "empty string is not valid datetime"); char *cur=cstr; - int date_delim=isdigit(cur[0])&&isdigit(cur[1])&&isdigit(cur[2])&&isdigit(cur[3])&&cur[4]==':'?':' + int date_delim=isdigit((unsigned char)cur[0])&&isdigit((unsigned char)cur[1])&&isdigit((unsigned char)cur[2])&&isdigit((unsigned char)cur[3])&&cur[4]==':'?':' :'-'; const char* year=lsplit(&cur, date_delim); const char* month=lsplit(&cur, date_delim); @@ -88,7 +88,8 @@ static int to_tm_year(int iyear) { cur=cstr; const char* hour=lsplit(&cur, ':'); const char* min=lsplit(&cur, ':'); - const char* sec=cur; + const char* sec=lsplit(&cur, '.'); + const char* msec=cur; tm tmIn; memset(&tmIn, 0, sizeof(tmIn)); tmIn.tm_isdst=-1; @@ -102,7 +103,7 @@ static int to_tm_year(int iyear) { tmIn.tm_mday=tmNow->tm_mday; goto date_part_set; } else - hour=min=sec=0; // not YYYY- & not HH: = just YYYY + hour=min=sec=msec=0; // not YYYY- & not HH: = just YYYY tmIn.tm_year=to_tm_year(pa_atoi(year)); tmIn.tm_mon=month?pa_atoi(month)-1:0; tmIn.tm_mday=mday?pa_atoi(mday):1; @@ -110,13 +111,13 @@ date_part_set: tmIn.tm_hour=hour?pa_atoi(hour):0; tmIn.tm_min=min?pa_atoi(min):0; tmIn.tm_sec=sec?pa_atoi(sec):0; + //tmIn.tm_[msec<