llGetTimestamp()
|
Bosozoku Kato
insurrectionist midget
Join date: 16 Jun 2003
Posts: 452
|
04-21-2004 05:13
I've asked for this a few times, and going to keep asking till it's finally in. This would be an incredibly simple function to add to LSL.
Gimme a freaking REAL time stamp based on the standard of Jan 1st, 1970 00:00:00 GMT (the server's clock naturally, I believe you can access that without having to think too hard and then pass it along to us tinkerers, via llGetTimestamp();)
thanks Boso
|
Oz Spade
ReadsNoPostLongerThanHand
Join date: 23 Sep 2003
Posts: 2,708
|
04-21-2004 05:56
This would be nice, I endorse this idea/feature.
_____________________
"Don't anticipate outcome," the man said. "Await the unfolding of events. Remain in the moment." - Konrad
|
Ezhar Fairlight
professional slacker
Join date: 30 Jun 2003
Posts: 310
|
04-21-2004 08:02
You can have your script send itself an email. The returned date in the email event will be a timestamp from the moment the mail was sent 
|
Eggy Lippmann
Wiktator
Join date: 1 May 2003
Posts: 7,939
|
04-21-2004 09:02
LOL Ez... it would take a while though 
|
Strife Onizuka
Moonchild
Join date: 3 Mar 2004
Posts: 5,887
|
04-21-2004 12:13
if your interested i have made a function for converting the date to an integer... integer dateToInteger(string a) { list b=llParseString2List(a, ["-"], []); integer year =(integer)llList2String(b,0)-1970; integer month=(integer)llList2String(b,1) - 1;
return llCeil( 365.25 * year - 0.5) + (integer)llList2String(b,2) + 31 * month - ( month - ( month > 7 ) ) / 2 - ( month > 1 ) - ( month > 1 && year % 4 != 2); }
think that should work haven't tested it since moding it for 1970
_____________________
Truth is a river that is always splitting up into arms that reunite. Islanded between the arms, the inhabitants argue for a lifetime as to which is the main river. - Cyril Connolly
Without the political will to find common ground, the continual friction of tactic and counter tactic, only creates suspicion and hatred and vengeance, and perpetuates the cycle of violence. - James Nachtwey
|
Christopher Omega
Oxymoron
Join date: 28 Mar 2003
Posts: 1,828
|
04-21-2004 15:08
Heh, if we needed day-based timestamps, that would be fins Strife. But Im sure Boso is referring to timestamps by the second, and preferrably .1th of a second. I WANT this  ==Chris
|
Bosozoku Kato
insurrectionist midget
Join date: 16 Jun 2003
Posts: 452
|
04-22-2004 05:40
Yes, time in seconds since Jan 1st 1970 at 00:00:00 GMT, or maybe it's 00:00:01.. anyway that's it. The standard. I care less what time it is on the server, in seconds, since midnight, etc. :P
Boso
|
Bino Arbuckle
Registered User
Join date: 31 Dec 2002
Posts: 369
|
04-22-2004 18:48
I'd like to see this too. Or match the time zones on llGetWallclock() and llGetDate(), which would be close enough for me. But I see no reason we can't have all of these things 
|
Bosozoku Kato
insurrectionist midget
Join date: 16 Jun 2003
Posts: 452
|
Thing is we only need ONE time stamp, everything else can easily be derived from...
04-23-2004 06:19
...the standard 1/1/1970 0 o'clock GMT. As the current functions basically already are anyway -- we just lack the real timestamp and are left with gimpness.
|
Steve Patel
Registered User
Join date: 4 May 2004
Posts: 39
|
How about..
09-17-2004 20:54
integer dateToSeconds(string timestamp) { list date =llParseString2List(timestamp, ["-"], []); integer year =(integer)llList2String(date,0) - 1970; integer month =(integer)llList2String(date,1) - 1; integer hour =(integer)llGetSubString(timestamp, 11, 12); integer minute =(integer)llGetSubString(timestamp, 14, 15); integer second =(integer)llGetSubString(timestamp, 17, 18); integer days = llCeil( 365.25 * year - 0.5) + (integer)llList2String(date,2) + 31 * month - ( month - ( month > 7 ) ) / 2 - ( month > 1 ) - ( month > 1 && year % 4 != 2); second += minute * 60; second += hour * 3600; second += days * 86400; return llAbs(second); }
Does that work? Just a slight change on the one above.
|
Bino Arbuckle
Registered User
Join date: 31 Dec 2002
Posts: 369
|
09-19-2004 18:59
I think we got a better timestamp function with 1.5 (or was it 1.4?)
This is a relatively old thread, but hopefully Bos will chime in with whether the new function does what he needs.
|
Steve Patel
Registered User
Join date: 4 May 2004
Posts: 39
|
09-20-2004 14:55
I needed to use this for something, and I couldn't find any other function, so I searched the wiki and the forums and found this.
There's llGetTime() but that's the time since the script started running and resets when you attach/detach something.
llGetGMTclock() and llGetWallclock() are both time's since midnight, just in different zones.
The other workaround is to have your script send itself an email. The email event has a unix timestamp in there, but that's a really bad way to handle this. If there is an easier function I must be missing it.
|
Bino Arbuckle
Registered User
Join date: 31 Dec 2002
Posts: 369
|
09-20-2004 20:43
It seems the change was that llGetTimestamp() was updated. Perhaps you weren't looking there since it seemed to be borked.
Of course, it doesn't seem to be exactly what Bos wanted, which was probably "number of secs since midnight 1/1/70", but it's at least got a date and a time and its standardized.
|
Steve Patel
Registered User
Join date: 4 May 2004
Posts: 39
|
09-21-2004 12:59
Right, and llGetTimestamp is what this function parses, and returns in seconds. Unless there's an error with it.
|
Sitting Lightcloud
Registered User
Join date: 13 May 2004
Posts: 109
|
bump
04-26-2005 11:24
Maybe in 1.6.4?  Guess it would have to be called float llGetUnixTimestamp() now
|