This function returns the current device clock value in milliseconds.
int _msec()
This function returns an int value giving the current device clock value in milliseconds.
This function obtains the current device clock value in milliseconds. The meaning of this value may vary from device to device.
Note: Because the returned value is an integer the maximum possible value is 2,147,483,647; meaning that the returned value is undefined in cases where the UJML player has been running continuously for more than 24.8 days.
Some devices support support Coordinated Universal Time (UTC) dates and times, in which case the clock value is the elapsed time since 12:00 A.M. UTC on the day the UJML player was started on the device. These devices will also support the _x_utcCurrentDate() function. See _x_utcCurrentDate() function. You can determine if the device supports UTC date/time by calling the _isSupported() function with the entity value &_X_UTC_DATETIME;. See Device Independence, Determining Device Context, _isSupported() function, Feature Support Information Entities.
The following example shows how to get the current device clock and puts it into a variable. It is part of the datetime.ujml sample.
mStartMsec = _msec();
The following example is a function that compares the current device clock against the variable loaded above to determine the elapsed time. It is part of the datetime.ujml sample.
<function name="elapsedTime" type="int">
<return><eval>_msec() - mStartMsec</eval></return>
</function>
The following example is a function that accepts a UTC time in milliseconds and converts it into hours, minutes, and seconds of local time. You must provide a time zone correction value to add or remove the correct number of hours for the current time zone (positive or negative values). Add another hour to the time zone correction value for Daylight Savings Time. For example, Pacific Time has a correction value of -8. But Pacific Time, when and where Daylight Savings Time is in effect, has a correction value of -7. It is part of the datetime.ujms sample.
<function name="setTime" type="void" visibility="public">
<parameters>
<var name="msecSinceMidnight" type="int"/>
<var name="timeZoneCorrection" type="int"/>
</parameters>
<script>
second = (msecSinceMidnight % 60000) / 1000;
minute = (msecSinceMidnight % 3600000) / 60000;
hour = ((msecSinceMidnight % 86400000) / 3600000);
hour = hour + timeZoneCorrection;
if (hour &_LT; 0)
{
hour = hour + 24;
}
else if (hour &_GT; 24)
{
hour = hour - 24;
}
</script>
</function>|
Copyright (c) 2000-2007 UIEvolution, Inc. All rights reserved.
|
|
What do you think about this topic? Send feedback!
|