Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

llGetWalldate()

Sitting Lightcloud
Registered User
Join date: 13 May 2004
Posts: 109
07-27-2005 12:54
Would be very helpful to get the current Date according to the llGetWallclock()

also

llGetUnixTimestamp() would be helpful

Thanks,

Sitting Lightcloud
_____________________

Jon Marlin
Builder, Coder, RL & SL
Join date: 10 Mar 2005
Posts: 297
07-28-2005 05:45
I've posted a solution for wallclock date to the Scripting Library, but who knows when that will show up.

[Edit] My post has shown up already in the Scripting Library - see /15/95/55540/1.html for an example function that returns PST/PDT date...

- Jon
_____________________
Come visit Marlin Engineering at Horseshoe (222, 26) to see my line of flying vehicles.
Sitting Lightcloud
Registered User
Join date: 13 May 2004
Posts: 109
07-28-2005 11:04
Very nice script! Thanks for posting that! I made something similar but it seems a bit ridiculous to have to have a whole script to get the current PST date when I'm sure they must have it handy somewhere :o
_____________________

Minsk Oud
Registered User
Join date: 12 Jul 2005
Posts: 85
07-28-2005 11:04
Still needs a little more testing, but here is a function from my collection of scripts to get the Unix timestamp:

CODE

// Written by Christopher Wolfe. This script is hereby placed in the public domain.

// Returns the current date and time as seconds since January 1st, 1970.
integer GetTimestamp() {
// Current UTC date as "YYYY-MM-DD"
string date = llGetDate();
integer year = (integer) llGetSubString(date, 0, 3);
integer month = (integer) llGetSubString(date, 5, 6);
integer day = (integer) llGetSubString(date, 8, 9);

// Initialize to seconds from January 1st, 1970 until January 1, 2005.
integer timestamp = 1104537600;

integer i;
for (i = 2005; i < year; ++i) {
timestamp += 31536000; // seconds in 365-day year
if ((i % 4) == 0) timestamp += 86400; // seconds in leap day
}

// Number of days from beginning of year to start of month in a non-leap year.
list by_month = [ 0, 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334 ];
timestamp += 86400 * (llList2Integer(by_month, month) + day - 1);
if ((year % 4) == 0 && month > 2) timestamp += 86400; // adjust for leap day

timestamp += llRound(llGetGMTclock()); // add time of day

return timestamp;
}
Sitting Lightcloud
Registered User
Join date: 13 May 2004
Posts: 109
07-28-2005 11:57
Thanks Minsk that can be very usefull!
_____________________