23 #include <sys/types.h>
35 #include <lib$routines.h>
62 rlTime::rlTime(
int Year,
int Month,
int Day,
int Hour,
int Minute,
int Second,
int Millisecond)
123 gettimeofday(&tv, &tz);
126 tms->tm_year += 1900;
130 second = (
int)tms->tm_sec;
131 minute = (int)tms->tm_min;
132 hour = (
int)tms->tm_hour;
133 day = (int)tms->tm_mday;
134 month = (
int)tms->tm_mon;
135 year = (int)tms->tm_year;
144 hour = (
int)tds.hour;
146 month = (
int)tds.month;
147 year = (int)tds.year;
169 if(lstat(filename,&statbuf))
return -1;
171 if(stat(filename,&statbuf))
return -1;
173 tms = localtime(&statbuf.st_mtime);
176 tms->tm_year += 1900;
180 second = (int)tms->tm_sec;
181 minute = (
int)tms->tm_min;
182 hour = (int)tms->tm_hour;
183 day = (
int)tms->tm_mday;
184 month = (int)tms->tm_mon;
185 year = (
int)tms->tm_year;
197 t.tm_mon =
month - 1;
198 t.tm_year =
year - 1900;
202 tv.tv_sec = mktime(&t);
204 settimeofday(&tv,NULL);
209 struct dsc$descriptor_s d_time;
210 char smonth[12][4],buf[64];
213 memset (smonth , 0,
sizeof(smonth));
214 memcpy (smonth [0],
"JAN", 3);
215 memcpy (smonth [1],
"FEB", 3);
216 memcpy (smonth [2],
"MAR", 3);
217 memcpy (smonth [3],
"APR", 3);
218 memcpy (smonth [4],
"MAY", 3);
219 memcpy (smonth [5],
"JUN", 3);
220 memcpy (smonth [6],
"JUL", 3);
221 memcpy (smonth [7],
"AUG", 3);
222 memcpy (smonth [8],
"SEP", 3);
223 memcpy (smonth [9],
"OCT", 3);
224 memcpy (smonth [10],
"NOV", 3);
225 memcpy (smonth [11],
"DEC", 3);
227 sprintf(buf,
"%02d-%3.3s-%04d %02d:%02d:%02d.%02d",
237 d_time.dsc$w_length = strlen(buf);
238 d_time.dsc$b_dtype = DSC$K_DTYPE_T;
239 d_time.dsc$b_class = DSC$K_CLASS_S;
240 d_time.dsc$a_pointer = buf;
242 sys$bintim(&d_time, &vbt);
306 int special = y % 400;
307 if(hth == 0 && special != 0) maxmonth = 28;
349 if(t.
day > maxmonth) { t.
month++; t.
day -= maxmonth; }
378 if(m <= 0) { m += 12; y--; }
391 int special = y % 400;
392 if(hth == 0 && special != 0) maxmonth = 28;
453 if(
day != time.
day)
return 0;
477 if(diff.
year < 0)
return 1;
478 if(diff.
month < 0)
return 1;
479 if(diff.
day < 0)
return 1;
480 if(diff.
hour < 0)
return 1;
481 if(diff.
minute < 0)
return 1;
482 if(diff.
second < 0)
return 1;
489 if((*
this) == time)
return 1;
490 if((*
this) < time)
return 1;
509 if(diff.
year < 0)
return 1;
510 if(diff.
month < 0)
return 1;
511 if(diff.
day < 0)
return 1;
512 if(diff.
hour < 0)
return 1;
513 if(diff.
minute < 0)
return 1;
514 if(diff.
second < 0)
return 1;
521 if((*
this) == time)
return 1;
522 if((*
this) > time)
return 1;
531 memset(&begin,0,
sizeof(tm));
532 memset(&test,0,
sizeof(tm));
541 test.tm_year =
year - 1900;
542 test.tm_mon =
month - 1;
548 time_t t0 = mktime(&begin);
549 time_t t1 = mktime(&test);
551 return difftime(t1,t0) + (((double)
millisecond) / 1000);