00001
00002
00003
00004
00005 #include <stdio.h>
00006 #include <string.h>
00007 #include <stdlib.h>
00008
00009 int main(int argc, char **argv)
00010 {
00011 double date;
00012 double sscan_time(char *ctime);
00013 int sprint_time(char *ctime, double date, char*zone, int prec);
00014 char newdate[100];
00015 double corr;
00016 int try;
00017 double time_events[][2] = {
00018 sscan_time("2006.01.01"), 0.0,
00019
00020 sscan_time("2222.01.01"), 0.0};
00021
00022 if (argc != 2 || strcmp(argv[1], "-h")==0)
00023 {
00024 fprintf(stderr,"fix_hmi_config_file_date DATE\n"
00025 "Convert DATE to corrected DATE where DATE is e.g. 2007.06.18_00:12:10\n");
00026 exit(0);
00027 }
00028
00029 date = sscan_time(argv[1]);
00030 if (date >= sscan_time("2222.01.01"))
00031 {
00032 fprintf(stderr,"Date absurd, %s\n", argv[1]);
00033 exit(1);
00034 }
00035
00036
00037 corr = 0;
00038 for (try=0; date >= time_events[try][0]; try++)
00039 corr = time_events[try][1];
00040 date += corr;
00041 sprint_time(newdate, date, "UTC", 0);
00042 printf("%19.19s\n",newdate);
00043 exit(0);
00044 }