Search
Forums
Kiwitrees on Twitter
    Tags

    HTML block, resources, 3.3.0, spam, transifex, internal messaging, error, married, individual resource, cousin tab, custom modules, fatal error, translation, notes, time, burial, GEDCOM, close, Themes change, google, 3.1, configure, pop-ups, ckeditor, Require visitor authentication, research tasks, login upgrade, source, icons, style, Google Maps, My Page, advent, media_links, shared note, custom text, privacy, last change date, permissions, 500, IE problem, title, PHP, html, json, prison, lists individuals families, FAQ, re-order, 3.0.0, sanity, defacto, immigration, drag, search, stories, backup, advanced, DSGVO, tools

    Topic:   2.0 UTC/Server Time  

    This topic contains 8 replies, has 3 voices, and was last updated by kiwi kiwi 4 years, 8 months ago.

    Viewing 9 posts - 1 through 9 (of 9 total)
    • Author
      Posts
    • #2292
      Roy
      Roy
      Participant

      110 posts

      Nigel:

      Finally got the update done. Thanks for a great job! I really like the Unlinked Individuals and Fancy Imagebar features.

      One issue; it appears the values for UTC and Server times in the Administration pages are turned around or are mislabeled.

      Thanks again.

      Roy Evans

      Roy

      Apache 2.4.27  PHP 7.19 MariaDB 10.2.8

      #2297
      kiwi
      kiwi
      Keymaster

      1660 posts

      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
      #2302
      Roy
      Roy
      Participant

      110 posts

      Nigel:

      This has me stumped. Am sending you an excerpt from the PHP report by email. Didn’t want to post it here because it contains my exact Lat/Long.

      Php.ini is correct. The kiwitrees’ PHP report is correct. The time on the server and client are both correct. The server and client are both in the -5 time zone. But the administration pages show:

      kiwitrees 2.0
      Server time — 2 March 2014 – 7:31:40 p.m.
      Client time — 2 March 2014 – 12:31:42 p.m.
      UTC — 2 March 2014 – 12:31:42 p.m.

      What I expect to see is:

      kiwitrees 2.0
      Server time — 2 March 2014 -12:31:42 p.m.
      Client time — 2 March 2014 – 12:31:42 p.m.
      UTC — 2 March 2014 – 7:31:40 p.m.

      Will send the PHP report excerpt shortly.

      Roy

      Roy

      Apache 2.4.27  PHP 7.19 MariaDB 10.2.8

      #2303
      kiwi
      kiwi
      Keymaster

      1660 posts

      Can you run the MYSQL function “SELECT UNIX_TIMESTAMP()” on your server and tell me what the result is.

      Nigel
      My personal kiwitrees site is www.our-families.info
      #2307
      Roy
      Roy
      Participant

      110 posts

      Nigel:

      It came me a return of 1,393,872,752

      I ran the query 1:53PM on 3/3/2014.

      I am pretty sure the timestamp is correct.

      Roy Evans

      Roy

      Apache 2.4.27  PHP 7.19 MariaDB 10.2.8

      #2310
      kiwi
      kiwi
      Keymaster

      1660 posts

      That number converts to Mon, 03 Mar 2014 18:52:32 GMT (If you want to redo this test yourself, a good place to convert Unix timestamps is http://www.onlineconversion.com/unix_time.htm

      As you are 5 hours behind UTC that does give the correct local time.
      So at that time your admin panel should have shown:

      Server time – 1:53PM on 3/3/2014
      Client time – 1:53PM on 3/3/2014
      UTC – 6:53PM on 3/3/2014

      If that was not the case then I do not see how, EXCEPT if you have the wrong version of one or more files. Try first clearing your browser cache, then if that doesn’t work try re-uploading these files:
      /includes/session.php
      /includes/functions/functions_date.php
      /themes/administration/header.php

      These files were modified at this latest version (as they were in webtrees 1.5.2) to correct an error in the calculation.

      Nigel
      My personal kiwitrees site is www.our-families.info
      #2321
      Roy
      Roy
      Participant

      110 posts

      Nigel:

      I think I will just ignore the administrative page times.

      I had cleared the caches several times. Downloaded a new copy of kiwitrees 2.0 and uploaded the recommended files with no change.

      Server shows correct time zone and time. It is correctly time stamping it’s logs. The kiwitrees’ logs are correctly time stamped. The kiwitrees PHP report is correct. Client shows correct time zone and time. Its logs are correctly time stamped.

      Don’t think it is worth any more time, yours and mine, chasing this demon.

      Thanks for all your help.

      Roy Evans

      Roy

      Apache 2.4.27  PHP 7.19 MariaDB 10.2.8

      #2326

      jacoline
      Participant

      466 posts

      One of the danish users (Ole Madsen) have seen the time translation is wrong

      %G:%i:%s instead of %g:%i:%s %a

      Perhabs the same problem here?

      Regards,
      Jamie Jaconelli

      admin and owner of:
      www.jaconelli.dk/webtrees, www.jaconelli.dk/history, www.familien-johnsen.dk(submenu) and danish support at www.host-siden.dk/sandbox and facebook

      #2327
      kiwi
      kiwi
      Keymaster

      1660 posts

      A good thought, but sadly no. The en_US is definitely %g:%i:%s %a which is correct.

      The default in the code (/library/WT/I18N.php) is actually %H:%i:%s but then each language, including en_US has their own translation. For American it translates to %g:%i:%s %a

      H = 24-hour format of an hour with leading zeros 00 through 23
      G = 24-hour format of an hour without leading zeros 0 through 23
      g = 12-hour format of an hour without leading zeros 1 through 12
      (the %a at the end adds the “am/pm” suffix)

      But all of these are just for display anyway. They don’t change the underlying time calculation.

      Nigel
      My personal kiwitrees site is www.our-families.info
    Viewing 9 posts - 1 through 9 (of 9 total)

    The topic ‘2.0 UTC/Server Time’ is closed to new replies.