BuildRange (InitForLoopEndRangeCheck (tsym, BySym)) ; (* --fixme-- pass endpostok. *)
IncQuad := NextQuad ;
(* we have explicitly checked using the above and also
- this addition can legally overflow if a cardinal type
+ this addition can legitimately overflow if a cardinal type
is counting down. The above test will generate a more
precise error message, so we suppress overflow detection
here. *)
BuildRange (InitForLoopEndRangeCheck (IdSym, BySym)) ;
IncQuad := NextQuad ;
(* we have explicitly checked using the above and also
- this addition can legally overflow if a cardinal type
+ this addition can legitimately overflow if a cardinal type
is counting down. The above test will generate a more
precise error message, so we suppress overflow detection
here. *)
(*
- LegalUnboundedParam - returns TRUE if the parameter, Actual, can legally be
+ LegalUnboundedParam - returns TRUE if the parameter, Actual, can legitimately be
passed to ProcSym, i, the, Formal, parameter.
*)
(*
- ExtractDate - extracts the year, month, day from days.
+ ExtractDate - extracts the year, month, day from secs. days is the
+ total days since 1970.
*)
PROCEDURE ExtractDate (days: LONGCARD;
VAR
testMonth,
testYear : CARDINAL ;
- testDays : LONGCARD ;
+ monthOfDays,
+ yearOfDays : LONGCARD ;
BEGIN
testYear := 1970 ;
LOOP
- testDays := daysInYear (31, 12, testYear) ;
- IF days < testDays
+ yearOfDays := daysInYear (31, 12, testYear) ;
+ IF days < yearOfDays
THEN
year := testYear ;
testMonth := 1 ;
LOOP
- testDays := daysInMonth (year, testMonth) ;
- IF days < testDays
+ monthOfDays := daysInMonth (year, testMonth) ;
+ IF days < monthOfDays
THEN
day := VAL (Day, days) + MIN (Day) ;
month := VAL (Month, testMonth) ;
RETURN
END ;
- DEC (days, testDays) ;
+ DEC (days, monthOfDays) ;
INC (testMonth)
END
ELSE
- DEC (days, testDays) ;
+ DEC (days, yearOfDays) ;
INC (testYear)
END
END
printf ("getclock = %ld\n", sec)
END ;
WITH userData DO
+ (* Here we keep dividing sec by max seconds, minutes, hours
+ to convert sec into total days since epoch. *)
second := VAL (Sec, DivMod (sec, MAX (Sec) + 1)) ;
minute := VAL (Min, DivMod (sec, MAX (Min) + 1)) ;
hour := VAL (Hour, DivMod (sec, MAX (Hour) + 1)) ;
#define NULL (void *)0
#endif
+typedef long long int longint_t;
+
/* GetTimeRealtime performs return gettime (CLOCK_REALTIME, ts).
gettime returns 0 on success and -1 on failure. If the underlying
#if defined(HAVE_STRUCT_TIMESPEC)
extern "C" int
-EXPORT(GetTimespec) (timespec *ts, unsigned long *sec, unsigned long *nano)
+EXPORT(GetTimespec) (timespec *ts, longint_t *sec, longint_t *nano)
{
#if defined(HAVE_STRUCT_TIMESPEC)
*sec = ts->tv_sec;
#else
extern "C" int
-EXPORT(GetTimespec) (void *ts, unsigned long *sec, unsigned long *nano)
+EXPORT(GetTimespec) (void *ts, longint_t *sec, longint_t *nano)
{
return 0;
}
#if defined(HAVE_STRUCT_TIMESPEC)
extern "C" int
-EXPORT(SetTimespec) (timespec *ts, unsigned long sec, unsigned long nano)
+EXPORT(SetTimespec) (timespec *ts, longint_t sec, longint_t nano)
{
#if defined(HAVE_STRUCT_TIMESPEC)
ts->tv_sec = sec;
#else
extern "C" int
-EXPORT(SetTimespec) (void *ts, unsigned long sec, unsigned long nano)
+EXPORT(SetTimespec) (void *ts, longint_t sec, longint_t nano)
{
return 0;
}
#endif
-extern "C" long int
+extern "C" longint_t
EXPORT(timezone) (void)
{
#if defined(HAVE_STRUCT_TIMESPEC)