Table of Contents

settime

WMPRO, WMMINI FW >= 1.0 WMMEGA FW >= 2.0

Set the system time from a Linux Timestamp, with optional calibration

Description

settime ( int $timestamp [, int $calibration ] )

This function will modify the system clock from a timestamp. If the optional calibration constant is included it will also modify the RTC register value to increase the time somewhat to compensate for clock lag.

Parameters

$timestamp: Seconds since January 1, 1970, 00:00:00, local Wattmon time

$calibration: Optional, value to set in the RTC calibration register1)

Return Values

None

Notes

Unlike mainline PHP, in uPHP “Linux Timestamps” are based upon the Wattmon's local time, not UTC/GMT.

Technically, the Unix Epoch is defined as being January 1, 1970, 00:00:00 GMT. But on the Wattmon, timestamps are relative to January 1, 1970, 00:00:00 local timezone.

If the Wattmon clock and timezone are set to UTC+00 (GMT) then the uPHP timestamp is the same as mainline PHP, otherwise not.

In uPHP on the Wattmon this simplification is referred to as a “Linux Timestamp” but it should be noted that it may not be exactly the same, depending on the Wattmon's timezone settings.

In other words: Wattmon “Linux Timestamps” are based upon local Wattmon time and are not adjusted by the timezone setting in Control Panel > Time Settings (Time and Date Settings) > UTC Offset. (These settings are stored in /config/time.ini.)

See Also

microtime() - Return the number of milliseconds since boot

mktime() - Return the Linux Timestamp for a given date and time

strftime() - Format a Linux Timestamp using a format string

time() - Return the current system timestamp

timefromfat() - Convert a FAT filetime to a Linux Timestamp

uptime() - Return the uptime in milliseconds

1)
The calibration register value is also stored in /config/time.ini key rtc_adjust.