25 lines
495 B
C
25 lines
495 B
C
|
#include <stdio.h>
|
||
|
#include "dtparser.h"
|
||
|
|
||
|
int main(int argc, char *argv[])
|
||
|
{
|
||
|
std::string s = "2010.10.22 11:12:13.14";
|
||
|
|
||
|
printf("%s\n", s.c_str());
|
||
|
|
||
|
prec_tm dt = datetime_sscanf(s.c_str());
|
||
|
|
||
|
printf("year = %.4d\n", dt.tm.tm_year + 1900);
|
||
|
printf("month = %.2d\n", dt.tm.tm_mon + 1);
|
||
|
printf("day = %.2d\n", dt.tm.tm_mday);
|
||
|
|
||
|
printf("hour = %.2d\n", dt.tm.tm_hour);
|
||
|
printf("min = %.2d\n", dt.tm.tm_min);
|
||
|
printf("sec = %.2d\n", dt.tm.tm_sec);
|
||
|
|
||
|
printf("ssec = %.2d\n", dt.ss);
|
||
|
|
||
|
return 0;
|
||
|
}
|
||
|
|