1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2<HTML>
3<HEAD>
4<META http-equiv="Content-Type" content="text/html; charset=windows-1252">
5<META name="GENERATOR" content="IBM WebSphere Studio Homepage Builder Version 7.0.0.0 for Windows">
6<META http-equiv="Content-Style-Type" content="text/css">
7<TITLE>OS_TicksTo*Seconds*</TITLE>
8<LINK rel="stylesheet" href="../../css/nitro.css" type="text/css">
9</HEAD>
10<BODY>
11<H1 align="left">OS_TicksTo*Seconds* <IMG src="../../image/NTR.gif" align="middle"><IMG src="../../image/TWL.gif" align="middle"></H1>
12<H2>Syntax</H2>
13<DL>
14  <DD>
15  <PRE><CODE>#include &lt;nitro/os.h&gt;</CODE></PRE>
16  <PRE><CODE>#define OS_TicksToMicroSeconds( tick )
17#define OS_TicksToMicroSeconds32( tick )
18
19#define OS_TicksToMilliSeconds( tick )
20#define OS_TicksToMilliSeconds32( tick )
21
22#define OS_TicksToSeconds( tick )
23#define OS_TicksToSeconds32( tick )
24</CODE>
25(These are all macros.)</PRE>
26</DL>
27<H2>Arguments</H2>
28<TABLE border="1" width="100%">
29  <TBODY>
30    <TR>
31<TD width="13%"><EM><STRONG>tick</STRONG></EM></TD>
32<TD width="87%">Tick Value</TD>
33    </TR>
34  </TBODY>
35</TABLE>
36<H2>Return Values</H2>
37<P>The actual time that corresponds to the tick value that is specified in the argument.</P>
38<H2>Description</H2>
39<P>This function obtains the actual time that corresponds to the tick value that is specified in the argument.</P>
40<P>One tick unit is 1/64 of the system clock.</P>
41<P><CODE>OS_TicksToMicroSeconds*()</CODE> converts the tick value to microseconds.<BR><CODE>OS_TicksToMilliSeconds*()</CODE> converts the tick value to milliseconds.<BR><CODE>OS_TicksToSeconds*()</CODE> converts the tick value to seconds.<BR>These functions are all defined as macros.</P>
42<P>Functions with <CODE>32</CODE> in their names conduct 32-bit internal calculations. Those without <CODE>32</CODE> conduct 64-bit calculations. 32-bit versions handle smaller values than 64-bit versions, so they cannot always return correct results because of overflow. However, when there is no overflow, they have the advantage of keeping the code smaller, making operating speed faster. However, since the degree of difference is not that great, and to prevent bugs, we recommend you use functions that do not include <CODE>32</CODE> in the name. Furthermore, when a constant is made into an argument, it is calculated just before compiling and the resulting value is also a constant.</P>
43<P>When operating in 32-bit mode, be careful of overflow. Values that will cause overflow are in the following table.</P>
44<TABLE border="1">
45  <TBODY>
46    <TR>
47<TH>Function Name</TH>
48<TH>This value or less is OK.</TH>
49<TH>Beyond this value is not allowed.</TH>
50    </TR>
51    <TR>
52<TD><CODE>OS_TicksToSeconds32()</CODE></TD>
53<TD>67108863 (tick units)<BR> This value is approximately 2 seconds.</TD>
54<TD>67108864 (tick units)<BR>
55      </TD>
56    </TR>
57    <TR>
58<TD><CODE>OS_TicksToMilliSeconds32()</CODE></TD>
59<TD>67108863 (tick units)<BR> This value is approximately 2002 milliseconds (2 seconds).</TD>
60<TD>67108864 (tick units)<BR>
61      </TD>
62    </TR>
63    <TR>
64<TD><CODE>OS_TicksToMicroSeconds32()</CODE></TD>
65<TD>67108 (tick units)<BR> This value is approximately 2002 microseconds (0.000002 seconds).</TD>
66<TD>67109 (tick units)<BR>
67      </TD>
68    </TR>
69  </TBODY>
70</TABLE>
71<P><BR>Further, values that overflow in 64-bit operation are: about 2.8 x 10 to the 14th tick units (about 99 days) for <CODE>OS_TicksToMicroSeconds*()</CODE>, and 2.8 x 10 to the 17th tick units (about 272 years) for <CODE>OS_TicksToMilliSeconds*()</CODE> and <CODE>OS_TicksToSeconds*()</CODE>.</P>
72<H2>See Also</H2>
73<P><CODE><A href="OS_InitTick.html">OS_InitTick</A><BR> <A href="OS_GetTick.html">OS_GetTick</A><BR> <A href="../alarm/OS_SetAlarm.html">OS_SetAlarm</A><BR> <A href="../alarm/OS_SetPeriodicAlarm.html">OS_SetPeriodicAlarm</A><BR> <A href="OS_SecondsToTicks.html">OS_*SecondsToTicks</A></CODE></P>
74<H2>Revision History</H2>
75<P>2005/10/07 Changed differences between 32-bit and 64-bit operation.<BR>2005/10/06 Considered and changed overflow for 32-bit and 64-bit operation.<BR> 2004/02/25 Changed Count to Tick.<BR> 2004/02/24 Initial version.</P>
76<hr><p>CONFIDENTIAL</p></body>
77</HTML>