Previous Book Contents Book Index Next

Inside Macintosh: Operating System Utilities /
Chapter 4 - Date, Time, and Measurement Utilities / Date, Time, and Measurement Utilities Reference
Routines / Getting the Current Date and Time


GetTime

You can use the GetTime procedure to obtain the current date-time information, expressed as a date and time.

PROCEDURE GetTime (VAR d: DateTimeRec);
d
On return, the fields of the date-time record contain the current date and time.
DESCRIPTION
The GetTime procedure returns in the d parameter the current date and time. The GetTime procedure first calls the GetDateTime procedure to obtain the number of seconds elapsed since midnight, January 1, 1904. It then calls the SecondsToDate procedure to convert the number of seconds (returned by the GetDateTime procedure) into a date and time.

As an alternative to using the GetTime procedure, you can pass the value of the global variable Time to the SecondsToDate procedure; a SecondsToDate(Time) procedure call is identical to a GetTime(d) procedure call.

SEE ALSO
For more information about the SecondsToDate procedure, see page 4-38. The GetDateTime procedure is described on page 4-35. For sample code that uses the GetTime procedure to get the current date and time, see Listing 4-2 on page 4-10. The date-time record is described in detail beginning on page 4-23.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
6 JUL 1996