Convsecs()

From TinyMUX
Jump to navigation Jump to search


convsecs(<seconds> [, <zonename>][, <precision>])

By default, this function converts an integer (representing a count of seconds from Jan 01 00:00:00 1970 UTC) to a local time string -- where local time is the time at the machine running the MUX. This conversion includes a timezone/daylight savings time conversion between UTC and the local time zone.

If a second argument is given, it is the <zonename>:

  • local
    • indicates that a conversion for timezone/DST of the 'local' server time should be applied (the default).
  • utc
    • indicates that no timezone/DST conversions should be applied. When used this way, there is a unique one-to-one relationship between an integer and it's corresponding text-string which may be useful for handling other timezones and fictional settings.

<precision> determines the number of fractional seconds shown. By default, no fractional seconds are shown.

Example

> say secs()

You say "957558109"

> say secs(local)

You say "957532909"

> say convsecs(957558109)

You say "Fri May 05 13:21:49 2000"

> say convsecs(957532909, utc)

You say "Fri May 05 13:21:49 2000"

Related Topics

convtime(), secs(), time()