Home    Refresh

Generate Wiki Research Time Image   - Example:  



Game Time Estimator
(Dynamic - No Refresh needed)
  Game Time Estimator
(Static - Must refresh to update)
  Ceg's Server Time
(Static - Must refresh to update)
Error        Error        10/14/2019 11:51:37 PM


server_time and last_rt, below, is Epoch Time ( seconds elapsed since: 01/01/1970 00:00:00 )

server_time:Current Epoch time of Ceg's server @ 10/14/2019 11:51:37 PM
last_rt:Last Real Time Game Server polled @ 9/27/2019 8:44:44 PM is when I received last update from game server (about every 5 minutes).

ERROR: 411 hour(s) has elapsed since 'Last Real Time Game Server polled' from current Time. Something is wrong! Game Time Estimator is not likely valid!
Refer to https://armeagle.atitd.org/tabtime.php for fallback clock.
last_gt:How many game seconds (not real seconds) has elapsed, since Start of Tale. This is calculated based on Last Egypt Time reported by game server: Year 1, Akhet III-18, 1:51AM, received last poll.
diff_rt:Math: server_time - last_rt = diff_rt  (How many real seconds has elapsed since last poll)
ratio:2.57425742574257Ratio is dynamic and is determined by server lag. 'Normally' Egypt time is 3 game minutes = 1 Egypt minute. Ratio will offset that 3 game minutes 'general rule'.
My Method of determining Ratio:
  • Every odd record (1, 3, 5, etc) I parse timeStamp as gt_secs AND rt_secs AND add the total of both over past 2 hours (last 24 time stamps).
  • Every even record (2, 4, 6, etc I parse timeStamp as prev_gt_secs AND prev_rt_secs AND add the total of both over past 2 hours (last 24 time stamps).
  • Ratio = (gt_secs - prev_gt_secs) / (rt_secs - prev_rt_secs)
  • diff_gt:Math: diff_rt * ratio = diff_gt

    Fun fact:   (Note: all values below will dynamically change depending on current ratio)
  • ratio/3 = 0.858
  • 1 + (1 - ratio/3) = 1.142
  • 60s * 1.142 = 68.52s - This means currently 68.52s = 1 Game Minute
  • 68.52s / 3 = 22.84s - This means currently 22.84s = 1 Egypt minute.
  • new_gt:Math: last_gt + diff_gt = new_gt
    new_gt_convert:Based on the new_gt value (game seconds (not real seconds) since beginning of Tale), I can deduce this is the current Egypt Time. Accuracy should be within 1-2 Egypt minutes
    Accuracy depends on how accurate Ratio value is (can change at anytime based on server load and other factors). Ratio value is an average over a period of time.



    Tab Time: (stand alone: https://atitd.sharpnetwork.net/gameclock/tabtime.asp ) - This will show current egypt time in tab delimited format. Useful to parse into an array with tab (as seperator) - \t on Javascript/PHP or vbtab on asp/aspx/vbscript.

    HTML Display:   Error

    Raw Display:
    Error


    Other Standalone versions you can use on your own website (include with <iframe> or whatever):

    Example (Note you can use http or https, depending on your site, to avoid cross content errors):
    <iframe src="https://atitd.sharpnetwork.net/gameClock_iframe.asp" width=400 height=15 frameborder=0 marginheight=0 marginwidth=0></iframe>
    



    Note, below link includes <meta http-equiv="refresh" content="900"> tag, which will refresh the page, automatically, every 15m for ensured accuracy.

    https://atitd.sharpnetwork.net/gameClock_iframe_simple.asp - Dynamic (time keeps updating without manually refreshing page)

    Additional parmameters you can add to querystring:
    noseconds=yes   ( Don't show (seconds) )
    norefresh=yes   ( Don't include <meta http-equiv="refresh" content="900"> tag - That forces page to refresh every 15m )

    Examples:
    https://atitd.sharpnetwork.net/gameClock_iframe_simple.asp?noseconds=yes
    https://atitd.sharpnetwork.net/gameClock_iframe_simple.asp?norefresh=yes
    https://atitd.sharpnetwork.net/gameClock_iframe_simple.asp?noseconds=yes&norefresh=yes

    Handy VBScript/.asp functions for Time
    '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
    function epoch2date(myEpoch)
    'Convert epoch Time to a Time/Date - ie <%=epoch2Date(1558811159)%>
      epoch2date = DateAdd("s", myEpoch, "01/01/1970 00:00:00")
    end function
    '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
    function date2epoch(myEpoch)
    'Convert a date to Epoch Time - ie blah =  date2epoch(Now)  or <%=date2epoch(Now)%> or myDate = "5/25/2019 7:02:25 PM" <%=date2epoch(myDate)%>
      date2epoch = DateDiff("s", "01/01/1970 00:00:00", myEpoch)
    end function
    '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
    
    ' Full Credits: ArmEagle, who wrote the original PHP version. Cegaiel simply converted functions from php to vbscript/.asp friendly.
    ' PHP Author: Alex Haan (ArmEagle). ArmEagle has full credits. My credits are minimal and based on converting his original PHP code, to VBScript.
    ' VBScript Author: Michael Sharp (Cegaiel)
    
    '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
    function itemsToGameSeconds( ct_yr, ct_sn, ct_mh, ct_dy, ct_hr, ct_mn, ct_ap )
    
    'ie last_gt = itemsToGameSeconds(3, "Shemu", "IV", 20, 4, 51, "PM")
    'Response.write(last_gt) or <%=last_gt%>
    
    '/*
    '* Input: array of items (year, season, etc)
    '* Output: (game) time seconds since 'start' of tale
    '* Based upon the following parameters, calculate number of game seconds since start
    '* year: digits
    '* season: Akhet, Peret, Shemu
    '* month: I, II, III, IV
    ' * day: digits
    ' * hour: digits
    ' * minute: digits
    ' * am/pm: AM, PM
    ' */
    
    
      '//YEARS
      years = ct_yr
    
      '//SEASONS
    SELECT CASE ct_sn
      CASE "Akhet"
      seasons = 3 * years
      CASE "Peret"
      seasons = 3 * years + 1
      CASE "Shemu"
      seasons = 3 * years + 2
    END SELECT
    
      '//MONTHS
    SELECT CASE ct_mh
      case "I"
        months = 4 * seasons
      case "II"
        months = 4 * seasons + 1
      case "III"
        months = 4 * seasons + 2
      case "IV"
        months = 4 * seasons + 3
    END SELECT
    
     '//DAYS
      days = 30 * months + ct_dy
    
      '//HOURS
      if ct_hr = 12 then
        ahour = 0
       else 
        ahour = ct_hr
      end If
    
    SELECT CASE ct_ap
      case "AM"
        hours = 24 * days + ahour
      case "PM"
        hours = 24 * days + 12 + ahour
    END SELECT
    
      //MINUTES
      mins = 60 * hours + ct_mn
    '  return 60 * mins
    itemsToGameSeconds = 60 * mins
    end function
    '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
    function gameSecondsToArray(new_gt)
    'ie:
    'last_gt = 130416211
    'new_gt_convert = gameSecondsToArray(new_gt)
    '<%=new_gt_convert%> or Response.write(new_gt_convert)
    'This will display as Year 4, Akhet III-9, 10:43 AM
    
    '/*** OUTPUT FUNCTIONS ***/
    
    '/*
    ' * Input: (game) time seconds since 'start' of tale
    ' * Output: (game) time items (year, season, month, etc)
    ' * convert game seconds to array of items (year, season, month, etc)
    ' */
    
    arr_items = array("year", "season", "month", "day", "hour", "minute", "ampm")
    arr_seasons = array("Akhet", "Peret", "Shemu")
    arr_months = array("I", "II", "III", "IV")
    arr_hours = array(12, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11)
    arr_ampm = array("AM", "AM", "AM", "AM", "AM", "AM", "AM", "AM", "AM", "AM", "AM", "AM", "PM", "PM", "PM", "PM", "PM", "PM", "PM", "PM", "PM", "PM", "PM", "PM")
    
    rest = new_gt
    ts_yr = int(rest / 31104000)
    rest = rest Mod 31104000
    ts_sn = int(rest / 10368000)
    rest = rest Mod 10368000
    ts_mh = int(rest / (2592000 + 86400))
    rest = rest Mod 2592000
    ts_dy = int(rest / 86400)
    if ts_dy = 0 Then ts_dy = 30
    rest = rest Mod 86400
    ts_hr = int(rest / 3600)
    rest = rest Mod 3600
    ts_mn = int(rest / 60)
    if ts_mn < 10 Then ts_mn = "0" & ts_mn
    ts_ampm = arr_ampm(ts_hr)
    
    gameSecondsToArray = "Year " & int(ts_yr) & ", " & arr_seasons(ts_sn) & " " & arr_months(ts_mh) & "-" & ts_dy & ", " & arr_hours(ts_hr) & ":" & ts_mn & " " & ts_ampm
    end function
    '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
    

    Copy/Paste friendly version of 'Handy VBScript/.asp functions for Time':