Template:Needs Translation/
函数名
|
Function: float llGetWallclock( );
|
参数:无
|
返回值:返回一个浮点数,它是自太平洋时间午夜(pst/pdt)以来以秒为单位的时间,截断为整秒。这与 slt 中用秒表示的一天的时间相同。
|
注意事项
|
All Issues ~ Search JIRA for related Bugs
|
示例
|
示例一
// Real World Sun
integer Flag;
default
{
state_entry()
{
Flag = -1;
llSetTimerEvent(0.1);
}
timer()
{
float time = llGetWallclock();
if (Flag == -1)
{
llSetTimerEvent(60.0);
}
if (time < 21600)
{
if (Flag)
{
llSetText("The Sun is coming! :)", <1,1,0>, 1.0);
Flag = 0;
}
}
else if (time < 64800)
{
if (Flag != 1)
{
llSetText("Sun has risen. :(", <1,0,0>, 1.0);
Flag = 1;
}
}
else if (Flag != 2)
{
llSetText("Goodbye Sun. :(", <1,0,0>, 1.0);
Flag = 2;
}
}
}
示例二
// Convert to human-readable HH:MM:SS format
string ConvertWallclockToTime()
{
integer now = (integer)llGetWallclock();
integer seconds = now % 60;
integer minutes = (now / 60) % 60;
integer hours = now / 3600;
return llGetSubString("0" + (string)hours, -2, -1) + ":"
+ llGetSubString("0" + (string)minutes, -2, -1) + ":"
+ llGetSubString("0" + (string)seconds, -2, -1);
}
default
{
touch_start(integer total_number)
{
llSay(0, ConvertWallclockToTime());
}
}
|