Maybe someone can help me out here.
The situation:
To make correct astronomical calculations I tried the available time functions.
llGetWallclock, llGetGMTclock and llGetTimestamp give accurate results, but llGetTime OfDay is approximately 65 seconds ahead. Substracting timeDilation (assuming the dilation is expressed in minutes, and is actually involved in the difference) gives a remaining 5 seconds difference. Not really something to write home about, but I want to understand how this actually works.
I tested this in several sims with several TimeDilations, but the difference was 62 to 65 seconds ahead, even with substantial timeDilations. There was no reboot of the testsims previously to or during the measurement. The script used is at the bottom of this message.
The questions:
- Why is llGetTimeOfDay ahead?
- Is there any relation with timeDilation?
I am also trying to find how llGetSunDirection relates to llGetTimeOfDay and whether it has the same delay or not. I am making a script for this right now but if anyone has information I would be very very happy!
Greetings and lots of fun
LillyX
---------------
TESTSCRIPT
// TimeCheck
// 23 jun 07
float SampleRate = 1; // 1 sim Sun hour = 10 min = 600 sec
default
{
state_entry()
{
integer i;
llSay(0,"TimeCheck Activated . . ."
; llSay(0,"Updated every "+(string)SampleRate+" seconds"
;llSetTimerEvent(SampleRate);
}
timer()
{ float fps = llGetRegionFPS();
float timeDilation = llGetRegionTimeDilation();
integer SimTime = (integer)llGetTimeOfDay();
integer SimHour = SimTime/3600;
integer SimMin = (SimTime%3600)/60;
integer SimSec = SimTime%60;
integer Time = (integer)llGetWallclock();
integer Hour = Time/3600;
integer Min = (Time%3600)/60;
integer Sec = Time%60;
integer GMT = (integer)llGetGMTclock();
integer GMTHour = GMT/3600;
integer GMTMin = (GMT%3600)/60;
integer GMTSec = GMT%60;
string TimeStamp = llGetTimestamp();
string TimeOfDay = (string)SimHour+"h"+(string)SimMin+"m"+(string)SimSec+"s";
string STime = (string)Hour+"h"+(string)Min+"m"+(string)Sec+"s";
string GMTTime = (string)GMTHour+"h"+(string)GMTMin+"m"+(string)GMTSec+"s";
llSay(0,"TimeOfDay: "+TimeOfDay+
" Wallclock: "+STime+
" GMT: "+GMTTime+
" TimeDilation: "+(string)(timeDilation*60)+
" Stamp: "+TimeStamp);
}
}