249 lines
6.3 KiB
HTML
249 lines
6.3 KiB
HTML
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|
<html>
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
|
<meta name="Copyright" content="Copyright (c) 2006 by IBM Corporation">
|
|
<title>Qp0zSetTimeofDay()--Set Software Clock</title>
|
|
<!-- Begin Header Records ========================================== -->
|
|
<!-- All rights reserved. Licensed Materials Property of IBM -->
|
|
<!-- US Government Users Restricted Rights -->
|
|
<!-- Use, duplication or disclosure restricted by -->
|
|
<!-- GSA ADP Schedule Contract with IBM Corp. -->
|
|
<!-- Direct1 SCRIPT J converted by B2H R4.1 (346) (CMS) by V2KEA304 -->
|
|
<!-- at RCHVMW2 on 17 Feb 1999 at 11:05:09 -->
|
|
<!-- Change History: -->
|
|
<!-- YYMMDD USERID Change description -->
|
|
<!-- Edited by Kersten Feb 02 -->
|
|
<!-- 0300918 JETAYLOR html cleanup -->
|
|
<!--End Header Records -->
|
|
<link rel="stylesheet" type="text/css" href="../rzahg/ic.css">
|
|
</head>
|
|
<body>
|
|
<a name="Top_Of_Page"></a>
|
|
<!-- Java sync-link -->
|
|
<script type="text/javascript" language="Javascript" src="../rzahg/synch.js">
|
|
</script>
|
|
|
|
<h2>Qp0zSetTimeofDay()--Set Software Clock</h2>
|
|
|
|
<div class="box" style="width: 70%;">
|
|
<br>
|
|
Syntax<br>
|
|
<pre>
|
|
#include <sys/time.h>
|
|
|
|
int Qp0zSetTimeofDay (struct timeval *<var>tp</var>,
|
|
struct timezone *<var>tzp</var>);
|
|
</pre>
|
|
|
|
<br>
|
|
Service Program Name: QP0ZSETC<br>
|
|
<!-- iddvc RMBR -->
|
|
<br>
|
|
Default Public Authority: *USE<br>
|
|
<!-- iddvc RMBR -->
|
|
<br>
|
|
Threadsafe: Yes<br>
|
|
<!-- iddvc RMBR -->
|
|
<br>
|
|
</div>
|
|
|
|
<p>The <strong>Qp0zSetTimeofDay()</strong> function sets the software clock to the
|
|
time contained in the timeval structure pointed to by <var>tp</var>. If <var>tzp</var>
|
|
is not NULL, the time zone information is also set.</p>
|
|
|
|
<p>
|
|
The software clock maintains a time that can be set independently of the system
|
|
clock. It is not integrated with the system and will be removed in a future
|
|
release. The <a href="settod.htm">settimeofday()</a> function should be used instead.
|
|
</p>
|
|
|
|
<br>
|
|
<h3>Parameters</h3>
|
|
|
|
<dl>
|
|
<dt><strong>tp</strong></dt>
|
|
|
|
<dd>(Input) A pointer to a timeval structure that contains the time in seconds
|
|
and microseconds since 1 January 1970, 00:00:00 UTC (epoch-1970).<br>
|
|
<br>
|
|
</dd>
|
|
|
|
<dt><strong>tzp</strong></dt>
|
|
|
|
<dd>(Input) A pointer to a timezone structure that contains the local time zone
|
|
(measured in minutes west of Greenwich) and a flag that, if
|
|
nonzero, indicates daylight saving time applies locally during the appropriate
|
|
part of the year.</dd>
|
|
</dl>
|
|
|
|
<br>
|
|
|
|
|
|
<h3>Authorities and Locks</h3>
|
|
|
|
<dl>
|
|
<dt><em>QSYS/QP0ZXCPA Service Program Authority</em></dt>
|
|
|
|
<dd>*USE</dd>
|
|
</dl>
|
|
|
|
<br>
|
|
<h3>Return Value</h3>
|
|
|
|
<table cellpadding="5">
|
|
<!-- cols="5 95" -->
|
|
<tr>
|
|
<td align="left" valign="top"><em>0</em></td>
|
|
|
|
<td align="left" valign="top"><strong>Qp0zSetTimeofDay()</strong> was successful.</td>
|
|
</tr><tr>
|
|
<td align="left" valign="top"><em>-1</em></td>
|
|
|
|
<td align="left" valign="top"><strong>Qp0zSetTimeofDay()</strong> was not successful. The <var>errno</var>
|
|
variable is set to indicate the error.</td>
|
|
</tr>
|
|
</table>
|
|
|
|
<br>
|
|
<h3>Error Conditions</h3>
|
|
|
|
<p>If <strong>Qp0zSetTimeofDay()</strong> is not successful, <var>errno</var>
|
|
usually indicates one of the following errors. Under some conditions,
|
|
<var>errno</var> could indicate an error other than those listed here.</p>
|
|
|
|
<table cellpadding="5">
|
|
<!-- cols="15 85" -->
|
|
<tr>
|
|
<td align="left" valign="top"><em>[EINVAL]</em></td>
|
|
<td align="left" valign="top">An invalid parameter was found.
|
|
|
|
<p>A parameter passed to this function is not valid.</p>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td align="left" valign="top"><em>[EFAULT]</em></td>
|
|
<td align="left" valign="top">The address used for an argument is not correct.
|
|
|
|
<p>In attempting to use an argument in a call, the system detected an address
|
|
that is not valid.</p>
|
|
|
|
<p>While attempting to access a parameter passed to this function, the system
|
|
detected an address that is not valid.</p>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td align="left" valign="top"><em>[EPERM]</em></td>
|
|
<td align="left" valign="top">Operation not permitted.
|
|
|
|
<p>You must have appropriate privileges or be the owner of the object or other
|
|
resource to do the requested operation.</p>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td align="left" valign="top"><em>[EUNKNOWN]</em></td>
|
|
<td align="left" valign="top">Unknown system state.
|
|
|
|
<p>The operation failed because of an unknown system state. See any messages in
|
|
the job log and correct any errors that are indicated, then retry the
|
|
operation.</p>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
|
|
<br>
|
|
<br>
|
|
<h3>Error Messages</h3>
|
|
|
|
<p>None.</p>
|
|
|
|
<br>
|
|
<h3>Usage Notes</h3>
|
|
|
|
|
|
<p>If the value of the environment variable QIBM_USE_SFWCLK is "N",
|
|
<strong>Qp0zSetTimeofDay()</strong> calls <strong>settimeofday()</strong> to
|
|
adjust the system clock.</p>
|
|
|
|
|
|
<br>
|
|
<h3>Related Information</h3>
|
|
|
|
<ul>
|
|
<li>The <<strong>sys/time.h</strong>> file (see <a href=
|
|
"unix13.htm">Header Files for UNIX-Type Functions</a>)<br>
|
|
<br>
|
|
</li>
|
|
|
|
<li><a href="settod.htm">settimeofday()--Set System Clock</a><br>
|
|
<br>
|
|
</li>
|
|
|
|
<li><a href="qp0zadjtime.htm">Qp0zAdjTime()--Adjust Software Clock</a><br>
|
|
<br>
|
|
</li>
|
|
|
|
<li><a href="qp0zgettime.htm">Qp0zGetTimeofDay()--Get Software Clock Time</a></li>
|
|
</ul>
|
|
|
|
<br>
|
|
<h3>Example</h3>
|
|
|
|
<p>See <a href="../apiref/aboutapis.htm#codedisclaimer">Code disclaimer information</a>
|
|
for information pertaining to code examples.</p>
|
|
|
|
<p>The following example sets the software clock:</p>
|
|
|
|
<pre>
|
|
#include <sys/time.h>
|
|
#include <stdio.h>
|
|
#include <errno.h>
|
|
|
|
int main(int argc, char *argv[])
|
|
{
|
|
struct timeval now;
|
|
int rc;
|
|
|
|
time.tv_sec=866208142;
|
|
time.tv_usec=290944;
|
|
|
|
rc=Qp0zSetTimeofDay(&now, NULL);
|
|
if(rc==0) {
|
|
printf("Qp0zSetTimeofDay() successful.\n");
|
|
}
|
|
else {
|
|
printf("Qp0zSetTimeofDay() failed, "
|
|
"errno = %d\n",errno);
|
|
return -1;
|
|
}
|
|
|
|
return 0;
|
|
}
|
|
</pre>
|
|
|
|
<h3>Example Output</h3>
|
|
|
|
<pre>
|
|
Qp0zSetTimeofDay() successful.
|
|
</pre>
|
|
|
|
<br>
|
|
<hr>
|
|
API introduced: V5R3
|
|
|
|
<hr>
|
|
<center>
|
|
<table cellpadding="2" cellspacing="2">
|
|
<tr align="center">
|
|
<td valign="middle" align="center"><a href="#Top_Of_Page">Top</a> | <a href=
|
|
"unix.htm">UNIX-Type APIs</a> | <a href="aplist.htm">APIs by category</a></td>
|
|
</tr>
|
|
</table>
|
|
</center>
|
|
</body>
|
|
</html>
|
|
|