Skip to main content

localtime

Discworld driver help

localtime

Name

localtime() - convert to local time

Synopsis

#include <localtime.h>

mixed *localtime( int time );

Description

localtime() converts a time value (as returned by time()) into an array of values which represents the time locally. In the past time() was used to get the time in GMT (UTC), and then local definitions were used to determine the local offset from GMT. This roundabout approach is no longer necessary. localtime() returns the seconds, minutes and hours, the day, month and year, day of the week, day of the year, the name of the local timezone and how far the MUD is from GMT. This information is retrieved directly from the operating system and made available to the driver without the use of MUD-specific configuration files.

localtime() returns an array containing the values specified above. The index for each value is defined symbolically in localtime.h. The following table summarizes the array returned by localtime().

LT_SECSeconds after the minute (0..59)
LT_MINMinutes after the hour (0..59)
LT_HOURHour since midnight (0..23)
LT_MDAYDay of the month (1..31)
LT_MONMonths since January (0..11)
LT_YEARYear (guaranteed to be >= 1900)
LT_WDAYDays since Sunday (0..6)
LT_YDAYDays since January 1 (0..365)
LT_GMTOFFSeconds after GMT (UTC)
LT_ZONETimezone name
LT_ISDSTDaylight Savings Time flag

See also

ctime(), time(), time_expression(), uptime(), /include/localtimeh