Author
Reply
  • #2297

    Roy

    Sorry, but I don’t think so. They appear to be correct, and are identical to Greg’s code in webtrees. Perhaps some explanation will help.

    UTC is defined here by the code format_timestamp(WT_TIMESTAMP)

    WT_TIMESTAMP is taken from (int)WT_DB::prepare("SELECT UNIX_TIMESTAMP()")->fetchOne()); This is a standard MySQL function that The above statement will return the unix timestamp in seconds as an unsigned integer since ‘1970-01-01 00:00:00’ UTC. (See more at: W3 Resource)

    “format_timestamp(WT_TIMESTAMP)” simply restates that time-stamp as a human-readable date. You can check the code for that in /includes/functions/function_date.php, line 88.

    Server time is fairly similar. It starts with format_timestamp(WT_SERVER_TIMESTAMP).

    WT_SERVER_TIMESTAMP is WT_TIMESTAMP + (int)date('Z')

    Date(‘Z’) is the standard PHP date function which provides the timezone offset in seconds. The offset for timezones west of UTC is always negative, and for those east of UTC is always positive. To do this it does require that date.timezone is correctly set to your locale in your php.ini file. I assume that is correct in your case? You can check it in Administration > PHP info.

    Nigel
    My personal kiwitrees site is www.our-families.info