Hey Peoples,
Since the GNU-GPC site is down i cant check the manual pages...
Does GPC have date functions built in to handle unix timestamps? These timestamps seem to be number of seconds since January 1, 1970.
I could just write a function taking into account leap years and all.. but why do that when its most likely already included :)
Thanks
jamie
jallan wrote:
Since the GNU-GPC site is down i cant check the manual pages...
If you downloaded GPC (source or binary), you should also have the manual on your machine.
Does GPC have date functions built in to handle unix timestamps? These timestamps seem to be number of seconds since January 1, 1970.
I could just write a function taking into account leap years and all.. but why do that when its most likely already included :)
Yes, e.g., see gpc.pas (also on your machine :-).
{ Convert a Unix time value to broken-down local time. } procedure UnixTimeToTime (Time: UnixTimeType; var Year: Integer; var Month: Integer; var Day: Integer; var Hour: Integer; var Minute: Integer; var Second: Integer); asmname '_p_UnixTimeToTime';
{ Convert broken-down local time to a Unix time value. } function TimeToUnixTime (Year: Integer; Month: Integer; Day: Integer; Hour: Integer; Minute: Integer; Second: Integer): UnixTimeType; asmname '_p_TimeToUnixTime';
{ Get the real time. MicroSecond can be null and is ignored then. } function GetUnixTime (var MicroSecond: Integer): UnixTimeType; asmname '_p_GetUnixTime';
procedure UnixTimeToTimeStamp (UnixTime : UnixTimeType; var aTimeStamp : TimeStamp); asmname '_p_unix_time_to_time_stamp'; function TimeStampToUnixTime (protected var aTimeStamp : TimeStamp) : UnixTimeType; asmname '_p_time_stamp_to_unix_time'; function GetMicroSecondTime : MicroSecondTimeType; asmname '_p_get_micro_second_time';
Frank