Fl_Date_Time_Format::Fl_Date_Time_Format() { char dateBuffer[32]; char timeBuffer[32]; // make a special date and time - today :) struct tm t; t.tm_year = 100; // since 1900, -> 2000 t.tm_mon = 5; // June (January=0) t.tm_mday = 17; t.tm_hour = 22; t.tm_min = 48; t.tm_sec = 59; t.tm_wday = 0; // Sunday // Build local data and time strftime(timeBuffer,32,"%X",&t); strftime(dateBuffer,32,"%x",&t); // Build local date and time formats Fl_Date_Time::datePartsOrder[0] = 0; Fl_Date_Time::time24Mode = false; // to be determined below Fl_Date_Time::dateSeparator = parseDateOrTime(Fl_Date_Time::dateFormat,dateBuffer); Fl_Date_Time::timeSeparator = parseDateOrTime(Fl_Date_Time::timeFormat,timeBuffer); if (!Fl_Date_Time::time24Mode) strcat(Fl_Date_Time::timeFormat,"AM"); buildDateInputFormat(); buildTimeInputFormat(); }
/* ** Process time function arguments. argv[0] is a date-time stamp. ** argv[1] and following are modifiers. Parse them all and write ** the resulting time into the DateTime structure p. Return 0 ** on success and 1 if there are any errors. ** ** If there are zero parameters (if even argv[0] is undefined) ** then assume a default value of "now" for argv[0]. */ static int isDate( sqlite3_context *context, int argc, sqlite3_value **argv, DateTime *p ){ int i; const unsigned char *z; int eType; memset(p, 0, sizeof(*p)); if( argc==0 ){ return setDateTimeToCurrent(context, p); } if( (eType = sqlite3_value_type(argv[0]))==SQLITE_FLOAT || eType==SQLITE_INTEGER ){ p->iJD = (sqlite3_int64)(sqlite3_value_double(argv[0])*86400000.0 + 0.5); p->validJD = 1; }else{ z = sqlite3_value_text(argv[0]); if( !z || parseDateOrTime(context, (char*)z, p) ){ return 1; } } for(i=1; i<argc; i++){ z = sqlite3_value_text(argv[i]); if( z==0 || parseModifier(context, (char*)z, p) ) return 1; } return 0; }
/* ** Process time function arguments. argv[0] is a date-time stamp. ** argv[1] and following are modifiers. Parse them all and write ** the resulting time into the DateTime structure p. Return 0 ** on success and 1 if there are any errors. */ static int isDate(int argc, const char **argv, DateTime *p){ int i; if( argc==0 ) return 1; if( argv[0]==0 || parseDateOrTime(argv[0], p) ) return 1; for(i=1; i<argc; i++){ if( argv[i]==0 || parseModifier(argv[i], p) ) return 1; } return 0; }