IDL

SYSTIME

SYSTIME

The SYSTIME function returns the current time as either a date/time string, or as the number of seconds since 1 January 1970, or as a Julian date/time value. Additionally, given an arbitrary number of seconds since 1 January 1970, SYSTIME can also return the corresponding date/time string.

Examples


Desired Result Command Sample Result

Today's date as a string

SYSTIME() "Mon Jan 18 20:14:07 2038"
Today's date in UTC

SYSTIME(/UTC)

"Tue Jan 19 03:14:07 2038"

Number of seconds since 1970

SYSTIME(/SECONDS)

1455291115.8670001

Julian date/time value

SYSTIME(/JULIAN, /UTC)

2465442.6348032

A date string given a specified number of seconds

SYSTIME(ELAPSED=2000000000)

"Tue May 17 20:33:20 2033"

A Julian date given a specified number of seconds

SYSTIME(ELAPSED=2000000000, /JULIAN)

2463735.3564814

Syntax


Result = SYSTIME( [ELAPSED=value] [, /JULIAN] [, /SECONDS] [, /UTC] )

or

Result = SYSTIME( [SecondsFlag] [, ElapsedSeconds] [, /JULIAN] [, /UTC] )

Return Value


Returns the specified time as either a string or a double-precision value. If SECONDS or JULIAN is set then the result will be a double-precision value. Otherwise, the result will be a string in the format:

DOW MON DD HH:MM:SS YEAR

where DOW is the day of the week, MON is the month, DD is the day of the month, HH is the hour, MM is the minute, SS is the second, and YEAR is the year. By default, the date/time string is adjusted for the local time zone; use the UTC keyword to override this default.

Note: The precision of the returned value depends on your platform: Windows will have a precision in milliseconds while other platforms will have a precision in microseconds.

Arguments


SecondsFlag (Obsolete)

Set this argument to 0 to return a date/time string; set to 1 to return a double-precision value. If the JULIAN or SECONDS keyword is set, this argument is ignored.

Note: This argument is obsolete but will continue to work as expected. In new code you should use the SECONDS keyword instead.

ElapsedSeconds (Obsolete)

Set this argument to the number of seconds past 1 January 1970 UTC. If the ELAPSED keyword is set, this argument is ignored.

Note: This argument is obsolete but will continue to work as expected. In new code you should use the ELAPSED keyword instead.

Keywords


ELAPSED

Set this keyword to a double-precision value giving the number of seconds since 1 January 1970 00:00:00 UTC. In this case, SYSTIME uses this value for its computations instead of the current time.

Note: The returned date/time string is adjusted for the local time zone, unless the UTC keyword is set.

JULIAN

Set this keyword to specify that the current time is to be returned as a a double precision floating value containing the current Julian date/time. By default, the current time is adjusted for the local time zone; use the UTC keyword to override this default. This keyword is not allowed if the ElapsedSeconds argument is present.

Note: If the JULIAN keyword is set, SYSTIME will add a small offset to the returned date to eliminate roundoff errors. This offset is given by the larger of EPS and EPS*Julian, where Julian is the integer portion of the Julian date, and EPS is the EPS field from MACHAR. For typical Julian dates, this offset is approximately 6x10–10 (which corresponds to 5x10–5 seconds). This offset ensures that if the Julian date is converted back using CALDAT, then the hour, minute, and second will have the correct integer values.

SECONDS

Set this keyword to specify that the current time is to be returned as the number of seconds elapsed since 1 January 1970 UTC. This option is equivalent to setting the SecondsFlag argument to a non-zero value.

UTC

Set this keyword to specify that the value returned by SYSTIME is to be returned in Universal Time Coordinated (UTC) rather than being adjusted for the current time zone. UTC time is defined as Greenwich Mean Time updated with leap seconds.

Version History


Original

Introduced

8.5.2

Added ELAPSED keyword, obsolete SecondsFlag and ElapsedSeconds arguments

See Also


CALDAT, CALENDAR Procedure, JULDAY, TIMEGEN, TIC, TOC, TIMESTAMP


This information is not subject to the controls of the International Traffic in Arms Regulations (ITAR) or the Export Administration Regulations (EAR). However, it may be restricted from transfer to various embargoed countries under U.S. laws and regulations.
© 2016 Exelis Visual Information Solutions, Inc., a subsidiary of Harris Corporation