WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   General Authoring Discussion (https://www.wowinterface.com/forums/forumdisplay.php?f=20)
-   -   So it's not possible to get server side seconds-since-epoch? (https://www.wowinterface.com/forums/showthread.php?t=8561)

Aule 02-15-07 12:19 AM

So it's not possible to get server side seconds-since-epoch?
 
I'm adding features to a mod that requires an authoritative time/date stamp, so that users can report the last known time a given player was chosen as a target.

It seems that the only seconds-since-epoch functions are client-side and that there's no notion of "date" with any of the server side time functions.

This leaves me with two options:

1) Use GetTime() and just live with the fact that the "LastSeen" field will be garbage each time there is a server restart. (GetTime() returns server uptime, not SSE).

2) Use the time() function, try to figure out a way of determining what time zone the client is, and hope that their clock is accurate.


I'm thinking option 1 is by far the lesser of two evils.

Aule 02-15-07 12:47 AM

Implemented an initialization check...
 
Since there's a server restart in the morning I'll be able to test this.

In my addon init function I implemented this:

Code:

-- Has there been a server reboot?
local current = GetTime()
if (GrudgeBook_Config.LastInitTimestamp < current) then
    -- No, server is still up since last run.
else
    -- Yes.  Invalidate all timestamps.
    GrudgeBook_InvalidateLastSeen()
end
GrudgeBook_Config.LastInitTimestamp = current

For the rest of the mod if the timestamp is nil, I display it as "Unknown".

Seconds since epoch on the server would sure be nice right about now!!

Tekkub 02-15-07 08:19 PM

why don't you just use addon messages to create a list of offsets for each client? factor in the current lag if you have to.

Aule 02-15-07 10:32 PM

addon messages
 
Quote:

Originally Posted by Tekkub
why don't you just use addon messages to create a list of offsets for each client? factor in the current lag if you have to.

I completely don't understand.

If by addon message you mean using SendAddonMessage(), that won't work because you have to be in party, raid, guild or battleground.

Sorry for my stupidity....I don't understand the idea you're getting at with the list of offsets...

Thanks for the reply tho :)

Tekkub 02-15-07 11:10 PM

Well I was *obviously* thinking that "last known time a given player was chosen as a target" would only be of relevance to a party, raid or battleground group

^^

I see now, you're looking to save a history for the user? Why not use their local time then?


All times are GMT -6. The time now is 04:45 AM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI