Page 163 of 346 Start Back Next End ZBasic System Library 151 ZBasic Microcontrollers GetTimeValue Type Function returning UnsignedLong Invocation GetTimeValue() GetTimeValue(tick) Parameter Method Type Description tick ByVal integral The tick count to decompose. Discussion This function decomposes a tick count into the equivalent hour, minute, second and fractional second components and packs them into a 32-bit value as shown below. If the tick count is omitted, the value of Register.RTCTick is used. Note that Register.RTCTick is initialized to zero on power-up or reset. This corresponds to 0:00:00. Time Value Fields Bits Position Mask Description 31-27 &Hf8000000 Hour (0 to 23) 26-21 &H07e00000 Minute (0 to 59) 20-15 &H001f8000 Second (0 to 59) 14-0 &H00007fff Fractional Second (0 to F_RTC_TICK-1) The 'fractional second' field represents the accumulation of RTC ticks between each second. The floating point equivalent of the seconds value represented by the converted time value can be calculated using code like that shown in the example below. Example Dim time as UnsignedLong Dim seconds as Single ' compute the equivalent full and fractional seconds value time = GetTimeValue() seconds = CSng(Shr(time, 15) And &H3f) + _ CSng(time And &H7fff) / CSng(Register.RTCTickFrequency) Compatibility The first form of the function is not available if the RTC is not enabled in your application. Neither form is supported in BasicX compatibility mode or on VM mode ZX devices. See Also GetDate, GetDateValue, GetTime, GetTimestamp