type TimeStamp = packed record DateValid, TimeValid : Boolean; Year : Integer; Month : 1 .. 12; Day : 1 .. 31; DayOfWeek : 0 .. 6; { 0 means Sunday } Hour : 0 .. 23; Minute : 0 .. 59; Second : 0 .. 61; { to allow for leap seconds } MicroSecond: 0 .. 999999; TimeZone : Integer; { in seconds east of UTC } DST : Boolean; TZName1, TZName2 : String (32); end;
The TimeStamp
record holds all the information about a
particular time. You can get the current time with
GetTimeStamp
and you can get the date or time in a printable
form using the Date
and Time
functions.
TimeStamp is an ISO 10206 Extended Pascal extension. The fields DateValid, TimeValid, Year, Month, Day, Hour, Minute, Second are required by Extended Pascal, the other ones are GNU Pascal extensions.
program TimeStampDemo; var t: TimeStamp; begin GetTimeStamp (t); WriteLn ('DateValid: ', t.DateValid); WriteLn ('TimeValid: ', t.TimeValid); WriteLn ('Year: ', t.Year); WriteLn ('Month: ', t.Month); WriteLn ('Day: ', t.Day); WriteLn ('DayOfWeek (0 .. 6, 0=Sunday): ', t.DayOfWeek); WriteLn ('Hour (0 .. 23): ', t.Hour); WriteLn ('Minute (0 .. 59): ', t.Minute); WriteLn ('Second (0 .. 61): ', t.Second); WriteLn ('MicroSecond (0 .. 999999): ', t.MicroSecond); WriteLn ('TimeZone (in seconds east of UTC): ', t.TimeZone); WriteLn ('DST: ', t.DST); WriteLn ('TZName1: ', t.TZName1); WriteLn ('TZName2: ', t.TZName2); WriteLn; WriteLn ('Date is: ', Date (t)); WriteLn ('Time is: ', Time (t)); end.