Files
oldlinux-files/Ref-docs/POSIX/susv3/functions/tzset.html
2024-02-19 00:21:47 -05:00

212 lines
6.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>tzset</title>
</head>
<body bgcolor="white">
<script type="text/javascript" language="JavaScript" src="../jscript/codes.js">
</script>
<basefont size="3"> <a name="tzset"></a> <a name="tag_03_795"></a><!-- tzset -->
<!--header start-->
<center><font size="2">The Open Group Base Specifications Issue 6<br>
IEEE Std 1003.1-2001<br>
Copyright &copy; 2001 The IEEE and The Open Group, All Rights reserved.</font></center>
<!--header end-->
<hr size="2" noshade>
<h4><a name="tag_03_795_01"></a>NAME</h4>
<blockquote>daylight, timezone, tzname, tzset - set timezone conversion information</blockquote>
<h4><a name="tag_03_795_02"></a>SYNOPSIS</h4>
<blockquote class="synopsis">
<p><code><tt>#include &lt;<a href="../basedefs/time.h.html">time.h</a>&gt;<br>
<br>
</tt></code></p>
<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"> extern int daylight;<br>
extern long timezone;<br>
<img src="../images/opt-end.gif" alt="[Option End]" border="0"></tt></code></div>
<div class="box"><code><tt><sup>[<a href="javascript:open_code('CX')">CX</a>]</sup> <img src="../images/opt-start.gif" alt=
"[Option Start]" border="0"> extern char *tzname[2];<br>
void tzset(void); <img src="../images/opt-end.gif" alt="[Option End]" border="0"></tt></code></div>
<tt><br>
</tt></blockquote>
<h4><a name="tag_03_795_03"></a>DESCRIPTION</h4>
<blockquote>
<p>The <i>tzset</i>() function shall use the value of the environment variable <i>TZ</i> to set time conversion information used by
<a href="ctime.html"><i>ctime</i>()</a> , <a href="localtime.html"><i>localtime</i>()</a> , <a href=
"mktime.html"><i>mktime</i>()</a> , and <a href="strftime.html"><i>strftime</i>()</a> . If <i>TZ</i> is absent from the
environment, implementation-defined default timezone information shall be used.</p>
<p>The <i>tzset</i>() function shall set the external variable <i>tzname</i> as follows:</p>
<pre>
<tt>tzname[0] = "</tt><i>std</i><tt>";
tzname[1] = "</tt><i>dst</i><tt>";
</tt>
</pre>
<p>where <i>std</i> and <i>dst</i> are as described in the Base Definitions volume of IEEE&nbsp;Std&nbsp;1003.1-2001, <a href=
"../basedefs/xbd_chap08.html">Chapter 8, Environment Variables</a>.</p>
<p><sup>[<a href="javascript:open_code('XSI')">XSI</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0">
The <i>tzset</i>() function also shall set the external variable <i>daylight</i> to 0 if Daylight Savings Time conversions should
never be applied for the timezone in use; otherwise, non-zero. The external variable <i>timezone</i> shall be set to the
difference, in seconds, between Coordinated Universal Time (UTC) and local standard time. <img src="../images/opt-end.gif" alt=
"[Option End]" border="0"></p>
</blockquote>
<h4><a name="tag_03_795_04"></a>RETURN VALUE</h4>
<blockquote>
<p>The <i>tzset</i>() function shall not return a value.</p>
</blockquote>
<h4><a name="tag_03_795_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_795_06"></a>EXAMPLES</h4>
<blockquote>
<p>Example <i>TZ</i> variables and their timezone differences are given in the table below:</p>
<table border="1" cellpadding="3">
<tr valign="top">
<th align="center">
<p class="tent">TZ</p>
</th>
<th align="center">
<p class="tent">timezone</p>
</th>
</tr>
<tr valign="top">
<td align="left">
<p class="tent">EST5EDT</p>
</td>
<td align="left">
<p class="tent">5*60*60</p>
</td>
</tr>
<tr valign="top">
<td align="left">
<p class="tent">GMT0</p>
</td>
<td align="left">
<p class="tent">0*60*60</p>
</td>
</tr>
<tr valign="top">
<td align="left">
<p class="tent">JST-9</p>
</td>
<td align="left">
<p class="tent">-9*60*60</p>
</td>
</tr>
<tr valign="top">
<td align="left">
<p class="tent">MET-1MEST</p>
</td>
<td align="left">
<p class="tent">-1*60*60</p>
</td>
</tr>
<tr valign="top">
<td align="left">
<p class="tent">MST7MDT</p>
</td>
<td align="left">
<p class="tent">7*60*60</p>
</td>
</tr>
<tr valign="top">
<td align="left">
<p class="tent">PST8PDT</p>
</td>
<td align="left">
<p class="tent">8*60*60</p>
</td>
</tr>
</table>
</blockquote>
<h4><a name="tag_03_795_07"></a>APPLICATION USAGE</h4>
<blockquote>
<p>None.</p>
</blockquote>
<h4><a name="tag_03_795_08"></a>RATIONALE</h4>
<blockquote>
<p>None.</p>
</blockquote>
<h4><a name="tag_03_795_09"></a>FUTURE DIRECTIONS</h4>
<blockquote>
<p>None.</p>
</blockquote>
<h4><a name="tag_03_795_10"></a>SEE ALSO</h4>
<blockquote>
<p><a href="ctime.html"><i>ctime</i>()</a> , <a href="localtime.html"><i>localtime</i>()</a> , <a href=
"mktime.html"><i>mktime</i>()</a> , <a href="strftime.html"><i>strftime</i>()</a> , the Base Definitions volume of
IEEE&nbsp;Std&nbsp;1003.1-2001, <a href="../basedefs/xbd_chap08.html">Chapter 8, Environment Variables</a>, <a href=
"../basedefs/time.h.html"><i>&lt;time.h&gt;</i></a></p>
</blockquote>
<h4><a name="tag_03_795_11"></a>CHANGE HISTORY</h4>
<blockquote>
<p>First released in Issue 1. Derived from Issue 1 of the SVID.</p>
</blockquote>
<h4><a name="tag_03_795_12"></a>Issue 6</h4>
<blockquote>
<p>The example is corrected.</p>
</blockquote>
<div class="box"><em>End of informative text.</em></div>
<hr>
<hr size="2" noshade>
<center><font size="2"><!--footer start-->
UNIX &reg; is a registered Trademark of The Open Group.<br>
POSIX &reg; 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>