149 lines
5.1 KiB
HTML
149 lines
5.1 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|
<html>
|
|
<head>
|
|
<meta name="generator" content="HTML Tidy, see www.w3.org">
|
|
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
|
<link type="text/css" rel="stylesheet" href="style.css"><!-- Generated by The Open Group's rhtm tool v1.2.1 -->
|
|
<!-- Copyright (c) 2001 The Open Group, All Rights Reserved -->
|
|
<title>ftime</title>
|
|
</head>
|
|
<body bgcolor="white">
|
|
<script type="text/javascript" language="JavaScript" src="../jscript/codes.js">
|
|
</script>
|
|
|
|
<basefont size="3"> <a name="ftime"></a> <a name="tag_03_197"></a><!-- ftime -->
|
|
<!--header start-->
|
|
<center><font size="2">The Open Group Base Specifications Issue 6<br>
|
|
IEEE Std 1003.1-2001<br>
|
|
Copyright © 2001 The IEEE and The Open Group, All Rights reserved.</font></center>
|
|
|
|
<!--header end-->
|
|
<hr size="2" noshade>
|
|
<h4><a name="tag_03_197_01"></a>NAME</h4>
|
|
|
|
<blockquote>ftime - get date and time (<b>LEGACY</b>)</blockquote>
|
|
|
|
<h4><a name="tag_03_197_02"></a>SYNOPSIS</h4>
|
|
|
|
<blockquote class="synopsis">
|
|
<div class="box"><code><tt><sup>[<a href="javascript:open_code('XSI')">XSI</a>]</sup> <img src="../images/opt-start.gif" alt=
|
|
"[Option Start]" border="0"> #include <<a href="../basedefs/sys/timeb.h.html">sys/timeb.h</a>><br>
|
|
<br>
|
|
int ftime(struct timeb *</tt><i>tp</i><tt>); <img src="../images/opt-end.gif" alt="[Option End]" border="0"></tt></code></div>
|
|
|
|
<tt><br>
|
|
</tt></blockquote>
|
|
|
|
<h4><a name="tag_03_197_03"></a>DESCRIPTION</h4>
|
|
|
|
<blockquote>
|
|
<p>The <i>ftime</i>() function shall set the <i>time</i> and <i>millitm</i> members of the <b>timeb</b> structure pointed to by
|
|
<i>tp</i> to contain the seconds and milliseconds portions, respectively, of the current time in seconds since the Epoch. The
|
|
contents of the <i>timezone</i> and <i>dstflag</i> members of <i>tp</i> after a call to <i>ftime</i>() are unspecified.</p>
|
|
|
|
<p>The system clock need not have millisecond granularity. Depending on any granularity (particularly a granularity of one) renders
|
|
code non-portable.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_03_197_04"></a>RETURN VALUE</h4>
|
|
|
|
<blockquote>
|
|
<p>Upon successful completion, the <i>ftime</i>() function shall return 0; otherwise, -1 shall be returned.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_03_197_05"></a>ERRORS</h4>
|
|
|
|
<blockquote>
|
|
<p>No errors are defined.</p>
|
|
</blockquote>
|
|
|
|
<hr>
|
|
<div class="box"><em>The following sections are informative.</em></div>
|
|
|
|
<h4><a name="tag_03_197_06"></a>EXAMPLES</h4>
|
|
|
|
<blockquote>
|
|
<h5><a name="tag_03_197_06_01"></a>Getting the Current Time and Date</h5>
|
|
|
|
<p>The following example shows how to get the current system time values using the <i>ftime</i>() function. The <b>timeb</b>
|
|
structure pointed to by <i>tp</i> is filled with the current system time values for <i>time</i> and <i>millitm</i>.</p>
|
|
|
|
<pre>
|
|
<tt>#include <sys/timeb.h>
|
|
<br>
|
|
struct timeb tp;
|
|
int status;
|
|
...
|
|
status = ftime(&tp);
|
|
</tt>
|
|
</pre>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_03_197_07"></a>APPLICATION USAGE</h4>
|
|
|
|
<blockquote>
|
|
<p>For applications portability, the <a href="../functions/time.html"><i>time</i>()</a> function should be used to determine the
|
|
current time instead of <i>ftime</i>(). Realtime applications should use <a href=
|
|
"../functions/clock_gettime.html"><i>clock_gettime</i>()</a> to determine the current time instead of <i>ftime</i>().</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_03_197_08"></a>RATIONALE</h4>
|
|
|
|
<blockquote>
|
|
<p>None.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_03_197_09"></a>FUTURE DIRECTIONS</h4>
|
|
|
|
<blockquote>
|
|
<p>This function may be withdrawn in a future version.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_03_197_10"></a>SEE ALSO</h4>
|
|
|
|
<blockquote>
|
|
<p><a href="clock_getres.html"><i>clock_getres</i>()</a> , <a href="ctime.html"><i>ctime</i>()</a> , <a href=
|
|
"gettimeofday.html"><i>gettimeofday</i>()</a> , <a href="time.html"><i>time</i>()</a> , the Base Definitions volume of
|
|
IEEE Std 1003.1-2001, <a href="../basedefs/sys/timeb.h.html"><i><sys/timeb.h></i></a></p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_03_197_11"></a>CHANGE HISTORY</h4>
|
|
|
|
<blockquote>
|
|
<p>First released in Issue 4, Version 2.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_03_197_12"></a>Issue 5</h4>
|
|
|
|
<blockquote>
|
|
<p>Moved from X/OPEN UNIX extension to BASE.</p>
|
|
|
|
<p>Normative text previously in the APPLICATION USAGE section is moved to the DESCRIPTION.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_03_197_13"></a>Issue 6</h4>
|
|
|
|
<blockquote>
|
|
<p>This function is marked LEGACY.</p>
|
|
|
|
<p>The DESCRIPTION is updated to refer to "seconds since the Epoch" rather than "seconds since 00:00:00 UTC (Coordinated
|
|
Universal Time), January 1 1970" for consistency with other <i>time</i> functions.</p>
|
|
</blockquote>
|
|
|
|
<div class="box"><em>End of informative text.</em></div>
|
|
|
|
<hr>
|
|
<hr size="2" noshade>
|
|
<center><font size="2"><!--footer start-->
|
|
UNIX ® is a registered Trademark of The Open Group.<br>
|
|
POSIX ® is a registered Trademark of The IEEE.<br>
|
|
[ <a href="../mindex.html">Main Index</a> | <a href="../basedefs/contents.html">XBD</a> | <a href=
|
|
"../utilities/contents.html">XCU</a> | <a href="../functions/contents.html">XSH</a> | <a href="../xrat/contents.html">XRAT</a>
|
|
]</font></center>
|
|
|
|
<!--footer end-->
|
|
<hr size="2" noshade>
|
|
</body>
|
|
</html>
|
|
|