blob: e628ba76bc9be55a8f2d339cadd50235ec3037e6 [file] [log] [blame]
<!--
Documentation/_templates/layout.html
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership. The
ASF licenses this file to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance with the
License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
License for the specific language governing permissions and limitations
under the License.
-->
<!DOCTYPE html>
<html class="writer-html5" lang="en" >
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Clocks and Timers &mdash; NuttX latest documentation</title>
<link rel="stylesheet" href="../../_static/css/theme.css" type="text/css" />
<link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />
<link rel="stylesheet" href="../../_static/tabs.css" type="text/css" />
<link rel="stylesheet" href="../../_static/custom.css" type="text/css" />
<link rel="shortcut icon" href="../../_static/favicon.ico"/>
<!--[if lt IE 9]>
<script src="../../_static/js/html5shiv.min.js"></script>
<![endif]-->
<script type="text/javascript" id="documentation_options" data-url_root="../../" src="../../_static/documentation_options.js"></script>
<script src="../../_static/jquery.js"></script>
<script src="../../_static/underscore.js"></script>
<script src="../../_static/doctools.js"></script>
<script type="text/javascript" src="../../_static/js/theme.js"></script>
<link rel="index" title="Index" href="../../genindex.html" />
<link rel="search" title="Search" href="../../search.html" />
<link rel="next" title="Signal Interfaces" href="07_signals.html" />
<link rel="prev" title="Counting Semaphore Interfaces" href="05_counting_semaphore.html" />
</head>
<body class="wy-body-for-nav">
<div class="wy-grid-for-nav">
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
<div class="wy-side-scroll">
<div class="wy-side-nav-search" >
<a href="../../index.html" class="icon icon-home"> NuttX
<img src="../../_static/NuttX.png" class="logo" alt="Logo"/>
</a>
<!-- this version selector is quite ugly, should be probably replaced by something
more modern -->
<div class="version-selector">
<select onchange="javascript:location.href = this.value;">
<option value="../../../latest" selected="selected">latest</option>
<option value="../../../10.0.0" >10.0.0</option>
<option value="../../../10.0.1" >10.0.1</option>
<option value="../../../10.1.0" >10.1.0</option>
<option value="../../../10.2.0" >10.2.0</option>
<option value="../../../10.3.0" >10.3.0</option>
<option value="../../../11.0.0" >11.0.0</option>
<option value="../../../12.0.0" >12.0.0</option>
<option value="../../../12.1.0" >12.1.0</option>
<option value="../../../12.2.0" >12.2.0</option>
<option value="../../../12.2.1" >12.2.1</option>
<option value="../../../12.3.0" >12.3.0</option>
<option value="../../../12.4.0" >12.4.0</option>
<option value="../../../12.5.0" >12.5.0</option>
<option value="../../../12.5.1" >12.5.1</option>
<option value="../../../12.6.0" >12.6.0</option>
<option value="../../../12.7.0" >12.7.0</option>
<option value="../../../12.8.0" >12.8.0</option>
<option value="../../../12.9.0" >12.9.0</option>
<option value="../../../12.10.0" >12.10.0</option>
<option value="../../../12.11.0" >12.11.0</option>
</select>
</div>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="../../search.html" method="get">
<input type="text" name="q" placeholder="Search docs" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
</div>
<div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
<p class="caption"><span class="caption-text">Table of Contents</span></p>
<ul class="current">
<li class="toctree-l1"><a class="reference internal" href="../../index.html">Home</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../introduction/index.html">Introduction</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../quickstart/index.html">Getting Started</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../contributing/index.html">Contributing</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../introduction/inviolables.html">The Inviolable Principles of NuttX</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../platforms/index.html">Supported Platforms</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../components/index.html">OS Components</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../applications/index.html">Applications</a></li>
<li class="toctree-l1 current"><a class="reference internal" href="../index.html">API Reference</a><ul class="current">
<li class="toctree-l2 current"><a class="reference internal" href="index.html">Userspace API</a><ul class="current">
<li class="toctree-l3"><a class="reference internal" href="01_task_control.html">Task Control Interfaces</a></li>
<li class="toctree-l3"><a class="reference internal" href="02_task_scheduling.html">Task Scheduling Interfaces</a></li>
<li class="toctree-l3"><a class="reference internal" href="03_task_control.html">Task Control Interfaces</a></li>
<li class="toctree-l3"><a class="reference internal" href="04_message_queue.html">Named Message Queue Interfaces</a></li>
<li class="toctree-l3"><a class="reference internal" href="05_counting_semaphore.html">Counting Semaphore Interfaces</a></li>
<li class="toctree-l3 current"><a class="current reference internal" href="#">Clocks and Timers</a></li>
<li class="toctree-l3"><a class="reference internal" href="07_signals.html">Signal Interfaces</a></li>
<li class="toctree-l3"><a class="reference internal" href="08_pthread.html">Pthread Interfaces</a></li>
<li class="toctree-l3"><a class="reference internal" href="09_env_vars.html">Environment Variables</a></li>
<li class="toctree-l3"><a class="reference internal" href="10_filesystem.html">File System Interfaces</a></li>
<li class="toctree-l3"><a class="reference internal" href="11_network.html">Network Interfaces</a></li>
<li class="toctree-l3"><a class="reference internal" href="12_shared_memory.html">Shared Memory Interfaces</a></li>
<li class="toctree-l3"><a class="reference internal" href="13_boardctl.html">Board IOCTL</a></li>
<li class="toctree-l3"><a class="reference internal" href="13_logging.html">Logging</a></li>
<li class="toctree-l3"><a class="reference internal" href="structures.html">OS Data Structures</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="../os/index.html">Architecture APIs</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../../faq/index.html">FAQ</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../guides/index.html">Guides</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../glossary.html">Glossary</a></li>
</ul>
</div>
</div>
</nav>
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
<nav class="wy-nav-top" aria-label="top navigation">
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
<a href="../../index.html">NuttX</a>
</nav>
<div class="wy-nav-content">
<div class="rst-content">
<div role="navigation" aria-label="breadcrumbs navigation">
<ul class="wy-breadcrumbs">
<li><a href="../../index.html" class="icon icon-home"></a> &raquo;</li>
<li><a href="../index.html">API Reference</a> &raquo;</li>
<li><a href="index.html">Userspace API</a> &raquo;</li>
<li>Clocks and Timers</li>
<li class="wy-breadcrumbs-aside">
<a href="../../_sources/reference/user/06_clocks_timers.rst.txt" rel="nofollow"> View page source</a>
</li>
</ul>
<hr/>
</div>
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
<div itemprop="articleBody">
<div class="section" id="clocks-and-timers">
<h1>Clocks and Timers<a class="headerlink" href="#clocks-and-timers" title="Permalink to this headline"></a></h1>
<ul class="simple">
<li><p><a class="reference internal" href="#c.clock_settime" title="clock_settime"><code class="xref c c-func docutils literal notranslate"><span class="pre">clock_settime()</span></code></a></p></li>
<li><p><a class="reference internal" href="#c.clock_gettime" title="clock_gettime"><code class="xref c c-func docutils literal notranslate"><span class="pre">clock_gettime()</span></code></a></p></li>
<li><p><a class="reference internal" href="#c.clock_getres" title="clock_getres"><code class="xref c c-func docutils literal notranslate"><span class="pre">clock_getres()</span></code></a></p></li>
<li><p><a class="reference internal" href="#c.mktime" title="mktime"><code class="xref c c-func docutils literal notranslate"><span class="pre">mktime()</span></code></a></p></li>
<li><p><a class="reference internal" href="#c.gmtime" title="gmtime"><code class="xref c c-func docutils literal notranslate"><span class="pre">gmtime()</span></code></a></p></li>
<li><p><a class="reference internal" href="#c.localtime" title="localtime"><code class="xref c c-func docutils literal notranslate"><span class="pre">localtime()</span></code></a></p></li>
<li><p><a class="reference internal" href="#c.asctime" title="asctime"><code class="xref c c-func docutils literal notranslate"><span class="pre">asctime()</span></code></a></p></li>
<li><p><a class="reference internal" href="#c.ctime" title="ctime"><code class="xref c c-func docutils literal notranslate"><span class="pre">ctime()</span></code></a></p></li>
<li><p><a class="reference internal" href="#c.gmtime_r" title="gmtime_r"><code class="xref c c-func docutils literal notranslate"><span class="pre">gmtime_r()</span></code></a></p></li>
<li><p><a class="reference internal" href="#c.localtime_r" title="localtime_r"><code class="xref c c-func docutils literal notranslate"><span class="pre">localtime_r()</span></code></a></p></li>
<li><p><a class="reference internal" href="#c.asctime_r" title="asctime_r"><code class="xref c c-func docutils literal notranslate"><span class="pre">asctime_r()</span></code></a></p></li>
<li><p><a class="reference internal" href="#c.ctime_r" title="ctime_r"><code class="xref c c-func docutils literal notranslate"><span class="pre">ctime_r()</span></code></a></p></li>
<li><p><a class="reference internal" href="#c.timer_create" title="timer_create"><code class="xref c c-func docutils literal notranslate"><span class="pre">timer_create()</span></code></a></p></li>
<li><p><a class="reference internal" href="#c.timer_delete" title="timer_delete"><code class="xref c c-func docutils literal notranslate"><span class="pre">timer_delete()</span></code></a></p></li>
<li><p><a class="reference internal" href="#c.timer_settime" title="timer_settime"><code class="xref c c-func docutils literal notranslate"><span class="pre">timer_settime()</span></code></a></p></li>
<li><p><a class="reference internal" href="#c.timer_gettime" title="timer_gettime"><code class="xref c c-func docutils literal notranslate"><span class="pre">timer_gettime()</span></code></a></p></li>
<li><p><a class="reference internal" href="#c.timer_getoverrun" title="timer_getoverrun"><code class="xref c c-func docutils literal notranslate"><span class="pre">timer_getoverrun()</span></code></a></p></li>
<li><p><a class="reference internal" href="#c.gettimeofday" title="gettimeofday"><code class="xref c c-func docutils literal notranslate"><span class="pre">gettimeofday()</span></code></a></p></li>
<li><p><a class="reference internal" href="#c.gethrtime" title="gethrtime"><code class="xref c c-func docutils literal notranslate"><span class="pre">gethrtime()</span></code></a></p></li>
</ul>
<dl class="c function">
<dt id="c.clock_settime">
<span class="pre">int</span> <code class="sig-name descname"><span class="pre">clock_settime</span></code><span class="sig-paren">(</span><span class="pre">clockid_t</span> <em><span class="pre">clockid</span></em>, <em class="property"><span class="pre">const</span></em> <em class="property"><span class="pre">struct</span></em> <a class="reference internal" href="structures.html#c.timespec" title="timespec"><span class="pre">timespec</span></a> <span class="pre">*</span><em><span class="pre">tp</span></em><span class="sig-paren">)</span><a class="headerlink" href="#c.clock_settime" title="Permalink to this definition"></a><br /></dt>
<dd><dl class="field-list simple">
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>If successful, returns zero (<code class="docutils literal notranslate"><span class="pre">OK</span></code>). Otherwise,
a non-zero error number will be returned to indicate the error.</p>
</dd>
</dl>
</dd></dl>
<dl class="c function">
<dt id="c.clock_gettime">
<span class="pre">int</span> <code class="sig-name descname"><span class="pre">clock_gettime</span></code><span class="sig-paren">(</span><span class="pre">clockid_t</span> <em><span class="pre">clockid</span></em>, <em class="property"><span class="pre">struct</span></em> <a class="reference internal" href="structures.html#c.timespec" title="timespec"><span class="pre">timespec</span></a> <span class="pre">*</span><em><span class="pre">tp</span></em><span class="sig-paren">)</span><a class="headerlink" href="#c.clock_gettime" title="Permalink to this definition"></a><br /></dt>
<dd><dl class="field-list simple">
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>If successful, returns zero (<code class="docutils literal notranslate"><span class="pre">OK</span></code>). Otherwise,
a non-zero error number will be returned to indicate the error.</p>
</dd>
</dl>
</dd></dl>
<dl class="c function">
<dt id="c.clock_getres">
<span class="pre">int</span> <code class="sig-name descname"><span class="pre">clock_getres</span></code><span class="sig-paren">(</span><span class="pre">clockid_t</span> <em><span class="pre">clockid</span></em>, <em class="property"><span class="pre">struct</span></em> <a class="reference internal" href="structures.html#c.timespec" title="timespec"><span class="pre">timespec</span></a> <span class="pre">*</span><em><span class="pre">res</span></em><span class="sig-paren">)</span><a class="headerlink" href="#c.clock_getres" title="Permalink to this definition"></a><br /></dt>
<dd><dl class="field-list simple">
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>If successful, returns zero (<code class="docutils literal notranslate"><span class="pre">OK</span></code>). Otherwise,
a non-zero error number will be returned to indicate the error.</p>
</dd>
</dl>
</dd></dl>
<dl class="c function">
<dt id="c.mktime">
<a class="reference internal" href="structures.html#c.time_t" title="time_t"><span class="pre">time_t</span></a> <code class="sig-name descname"><span class="pre">mktime</span></code><span class="sig-paren">(</span><em class="property"><span class="pre">struct</span></em> <span class="pre">tm</span> <span class="pre">*</span><em><span class="pre">tp</span></em><span class="sig-paren">)</span><span class="pre">;</span><a class="headerlink" href="#c.mktime" title="Permalink to this definition"></a><br /></dt>
<dd><dl class="field-list simple">
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>If successful, returns zero (<code class="docutils literal notranslate"><span class="pre">OK</span></code>). Otherwise,
a non-zero error number will be returned to indicate the error.</p>
</dd>
</dl>
</dd></dl>
<dl class="c function">
<dt id="c.gmtime">
<span class="pre">FAR</span> <em class="property"><span class="pre">struct</span></em> <span class="pre">tm</span> <span class="pre">*</span><code class="sig-name descname"><span class="pre">gmtime</span></code><span class="sig-paren">(</span><span class="pre">FAR</span> <em class="property"><span class="pre">const</span></em> <a class="reference internal" href="structures.html#c.time_t" title="time_t"><span class="pre">time_t</span></a> <span class="pre">*</span><em><span class="pre">timep</span></em><span class="sig-paren">)</span><span class="pre">;</span><a class="headerlink" href="#c.gmtime" title="Permalink to this definition"></a><br /></dt>
<dd><p>Represents GMT date/time in a type <code class="docutils literal notranslate"><span class="pre">struct</span> <span class="pre">tm</span></code>. This
function is not re-entrant.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>timep</strong> – Represents GMT calendar time. This is an absolute time
value representing the number of seconds elapsed since 00:00:00 on
January 1, 1970, Coordinated Universal Time (UTC).</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>If successful, the function will return the pointer to a statically defined
instance of <code class="docutils literal notranslate"><span class="pre">struct</span> <span class="pre">tm</span></code>. Otherwise, a NULL will be returned to
indicate the error:</p>
</dd>
</dl>
</dd></dl>
<dl class="c function">
<dt id="c.localtime">
<span class="pre">FAR</span> <em class="property"><span class="pre">struct</span></em> <span class="pre">tm</span> <span class="pre">*</span><code class="sig-name descname"><span class="pre">localtime</span></code><span class="sig-paren">(</span><span class="pre">FAR</span> <em class="property"><span class="pre">const</span></em> <a class="reference internal" href="structures.html#c.time_t" title="time_t"><span class="pre">time_t</span></a> <span class="pre">*</span><em><span class="pre">timep</span></em><span class="sig-paren">)</span><a class="headerlink" href="#c.localtime" title="Permalink to this definition"></a><br /></dt>
<dd><p>Represents local date/time in a type <code class="docutils literal notranslate"><span class="pre">struct</span> <span class="pre">tm</span></code>.
This function is not re-entrant.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>timep</strong> – Represents GMT calendar time. This is an absolute time
value representing the number of seconds elapsed since 00:00:00 on
January 1, 1970, Coordinated Universal Time (UTC).</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>If successful, the function will return the pointer to a statically defined
instance of <code class="docutils literal notranslate"><span class="pre">struct</span> <span class="pre">tm</span></code>. Otherwise, a NULL will be returned to
indicate the error:</p>
</dd>
</dl>
</dd></dl>
<dl class="c function">
<dt id="c.asctime">
<span class="pre">FAR</span> <span class="pre">char</span> <span class="pre">*</span><code class="sig-name descname"><span class="pre">asctime</span></code><span class="sig-paren">(</span><span class="pre">FAR</span> <em class="property"><span class="pre">const</span></em> <em class="property"><span class="pre">struct</span></em> <span class="pre">tm</span> <span class="pre">*</span><em><span class="pre">tp</span></em><span class="sig-paren">)</span><span class="pre">;</span><a class="headerlink" href="#c.asctime" title="Permalink to this definition"></a><br /></dt>
<dd><p>Converts the time provided in a
<code class="docutils literal notranslate"><span class="pre">struct</span> <span class="pre">tm</span></code> to a string representation. <code class="docutils literal notranslate"><span class="pre">asctime()</span></code> is not
re-entrant.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>tp</strong> – Pointer to the time to be converted.</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>If successful, the function will
return a pointer to a statically defined string holding the converted
time. Otherwise, a NULL will be returned to indicate the error.</p>
</dd>
</dl>
</dd></dl>
<dl class="c function">
<dt id="c.ctime">
<span class="pre">FAR</span> <span class="pre">char</span> <span class="pre">*</span><code class="sig-name descname"><span class="pre">ctime</span></code><span class="sig-paren">(</span><span class="pre">FAR</span> <em class="property"><span class="pre">const</span></em> <a class="reference internal" href="structures.html#c.time_t" title="time_t"><span class="pre">time_t</span></a> <span class="pre">*</span><em><span class="pre">timep</span></em><span class="sig-paren">)</span><a class="headerlink" href="#c.ctime" title="Permalink to this definition"></a><br /></dt>
<dd><p>Converts the time provided in seconds since
the epoch to a string representation. <code class="docutils literal notranslate"><span class="pre">ctime()</span></code> is not re-entrant.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>timep</strong> – The current time represented as seconds since the epoch.</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>If successful, the function will return
the pointer to the converted string. Otherwise, a NULL will be returned
to indicate the error.</p>
</dd>
</dl>
</dd></dl>
<dl class="c function">
<dt id="c.gmtime_r">
<em class="property"><span class="pre">struct</span></em> <span class="pre">tm</span> <span class="pre">*</span><code class="sig-name descname"><span class="pre">gmtime_r</span></code><span class="sig-paren">(</span><em class="property"><span class="pre">const</span></em> <a class="reference internal" href="structures.html#c.time_t" title="time_t"><span class="pre">time_t</span></a> <span class="pre">*</span><em><span class="pre">timep</span></em>, <em class="property"><span class="pre">struct</span></em> <span class="pre">tm</span> <span class="pre">*</span><em><span class="pre">result</span></em><span class="sig-paren">)</span><span class="pre">;</span><a class="headerlink" href="#c.gmtime_r" title="Permalink to this definition"></a><br /></dt>
<dd><p>Represents GMT date/time in a type <code class="docutils literal notranslate"><span class="pre">struct</span> <span class="pre">tm</span></code>. This
function is re-entrant.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>timep</strong> – Represents GMT calendar time. This is an absolute time
value representing the number of seconds elapsed since 00:00:00 on
January 1, 1970, Coordinated Universal Time (UTC).</p></li>
<li><p><strong>result</strong> – A user-provided buffer to receive the converted time
structure.</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>If successful, the <code class="docutils literal notranslate"><span class="pre">gmtime_r()</span></code> function will
return the pointer, <code class="docutils literal notranslate"><span class="pre">result</span></code>, provided by the caller. Otherwise, a
NULL will be returned to indicate the error:</p>
</dd>
</dl>
</dd></dl>
<dl class="c function">
<dt id="c.localtime_r">
<span class="pre">FAR</span> <em class="property"><span class="pre">struct</span></em> <span class="pre">tm</span> <span class="pre">*</span><code class="sig-name descname"><span class="pre">localtime_r</span></code><span class="sig-paren">(</span><span class="pre">FAR</span> <em class="property"><span class="pre">const</span></em> <a class="reference internal" href="structures.html#c.time_t" title="time_t"><span class="pre">time_t</span></a> <span class="pre">*</span><em><span class="pre">timep</span></em>, <span class="pre">FAR</span> <em class="property"><span class="pre">struct</span></em> <span class="pre">tm</span> <span class="pre">*</span><em><span class="pre">result</span></em><span class="sig-paren">)</span><a class="headerlink" href="#c.localtime_r" title="Permalink to this definition"></a><br /></dt>
<dd><p>Represents local date/time in a type <code class="docutils literal notranslate"><span class="pre">struct</span> <span class="pre">tm</span></code>.
This function is re-entrant.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>timep</strong> – Represents GMT calendar time. This is an absolute time
value representing the number of seconds elapsed since 00:00:00 on
January 1, 1970, Coordinated Universal Time (UTC).</p></li>
<li><p><strong>result</strong> – A user-provided buffer to receive the converted time
structure.</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>If successful, the
<code class="docutils literal notranslate"><span class="pre">localtime_r()</span></code> function will return the pointer, <code class="docutils literal notranslate"><span class="pre">result</span></code>, provided
by the caller. Otherwise, a NULL will be returned to indicate the error:</p>
</dd>
</dl>
</dd></dl>
<dl class="c function">
<dt id="c.asctime_r">
<span class="pre">FAR</span> <span class="pre">char</span> <span class="pre">*</span><code class="sig-name descname"><span class="pre">asctime_r</span></code><span class="sig-paren">(</span><span class="pre">FAR</span> <em class="property"><span class="pre">const</span></em> <em class="property"><span class="pre">struct</span></em> <span class="pre">tm</span> <span class="pre">*</span><em><span class="pre">tp</span></em>, <span class="pre">FAR</span> <span class="pre">char</span> <span class="pre">*</span><em><span class="pre">buf</span></em><span class="sig-paren">)</span><a class="headerlink" href="#c.asctime_r" title="Permalink to this definition"></a><br /></dt>
<dd><p>Converts the time provided in a
<code class="docutils literal notranslate"><span class="pre">struct</span> <span class="pre">tm</span></code> to a string representation. <code class="docutils literal notranslate"><span class="pre">asctime-r()</span></code> is re-entrant.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>tp</strong> – Pointer to the time to be converted.</p></li>
<li><p><strong>buf</strong> – The user provider buffer. of size &gt;= 26 characters, to
receive the converted time.</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>If successful, the <code class="docutils literal notranslate"><span class="pre">asctime_r()</span></code> function will
return the pointer, <code class="docutils literal notranslate"><span class="pre">buf</span></code>, provided by the caller. Otherwise, a NULL
will be returned to indicate the error.</p>
</dd>
</dl>
</dd></dl>
<dl class="c function">
<dt id="c.ctime_r">
<span class="pre">FAR</span> <span class="pre">char</span> <span class="pre">*</span><code class="sig-name descname"><span class="pre">ctime_r</span></code><span class="sig-paren">(</span><span class="pre">FAR</span> <em class="property"><span class="pre">const</span></em> <a class="reference internal" href="structures.html#c.time_t" title="time_t"><span class="pre">time_t</span></a> <span class="pre">*</span><em><span class="pre">timep</span></em>, <span class="pre">FAR</span> <span class="pre">char</span> <span class="pre">*</span><em><span class="pre">buf</span></em><span class="sig-paren">)</span><a class="headerlink" href="#c.ctime_r" title="Permalink to this definition"></a><br /></dt>
<dd><p>Converts the time provided in seconds
since the epoch to a string representation. <code class="docutils literal notranslate"><span class="pre">ctime()</span></code> is re-entrant.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>timep</strong> – The current time represented as seconds since the epoch.</p></li>
<li><p><strong>buf</strong> – The user provider buffer. of size &gt;= 26 characters, to
receive the converted time.</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>If successful, the <code class="docutils literal notranslate"><span class="pre">ctime_r()</span></code> function will
return the pointer, <code class="docutils literal notranslate"><span class="pre">buf</span></code>, provided by the caller. Otherwise, a NULL
will be returned to indicate the error.</p>
</dd>
</dl>
</dd></dl>
<dl class="c function">
<dt id="c.timer_create">
<span class="pre">int</span> <code class="sig-name descname"><span class="pre">timer_create</span></code><span class="sig-paren">(</span><span class="pre">clockid_t</span> <em><span class="pre">clockid</span></em>, <em class="property"><span class="pre">struct</span></em> <a class="reference internal" href="structures.html#c.sigevent" title="sigevent"><span class="pre">sigevent</span></a> <span class="pre">*</span><em><span class="pre">evp</span></em>, <span class="pre">timer_t</span> <span class="pre">*</span><em><span class="pre">timerid</span></em><span class="sig-paren">)</span><span class="pre">;</span><a class="headerlink" href="#c.timer_create" title="Permalink to this definition"></a><br /></dt>
<dd><p>Creates per-thread
timer using the specified clock, <code class="docutils literal notranslate"><span class="pre">clock_id</span></code>, as the timing base. The
<code class="docutils literal notranslate"><span class="pre">timer_create()</span></code> function returns, in the location referenced by
<code class="docutils literal notranslate"><span class="pre">timerid</span></code>, a timer ID of type timer_t used to identify the timer in
timer requests. This timer ID is unique until the timer is deleted. The
particular clock, <code class="docutils literal notranslate"><span class="pre">clock_id</span></code>, is defined in <code class="docutils literal notranslate"><span class="pre">&lt;time.h&gt;</span></code>. The timer
whose ID is returned will be in a disarmed state upon return from
<code class="docutils literal notranslate"><span class="pre">timer_create()</span></code>.</p>
<p>The <code class="docutils literal notranslate"><span class="pre">evp</span></code> argument, if non-NULL, points to a <code class="docutils literal notranslate"><span class="pre">sigevent</span></code> structure.
This structure is allocated by the called and defines the asynchronous
notification to occur. If the <code class="docutils literal notranslate"><span class="pre">evp</span></code> argument is NULL, the effect is as
if the <code class="docutils literal notranslate"><span class="pre">evp</span></code> argument pointed to a <code class="docutils literal notranslate"><span class="pre">sigevent</span></code> structure with the
<code class="docutils literal notranslate"><span class="pre">sigev_notify</span></code> member having the value <code class="docutils literal notranslate"><span class="pre">SIGEV_SIGNAL</span></code>, the
<code class="docutils literal notranslate"><span class="pre">sigev_signo</span></code> having a default signal number, and the <code class="docutils literal notranslate"><span class="pre">sigev_value</span></code>
member having the value of the timer ID.</p>
<p>Each implementation defines a set of clocks that can be used as timing
bases for per-thread timers. All implementations will support a
<code class="docutils literal notranslate"><span class="pre">clock_id</span></code> of <code class="docutils literal notranslate"><span class="pre">CLOCK_REALTIME</span></code>.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>clockid</strong> – Specifies the clock to use as the timing base. Must be
<code class="docutils literal notranslate"><span class="pre">CLOCK_REALTIME</span></code>.</p></li>
<li><p><strong>evp</strong> – Refers to a user allocated sigevent structure that defines
the asynchronous notification. evp may be NULL (see above).</p></li>
<li><p><strong>timerid</strong> – The pre-thread timer created by the call to
timer_create().</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p><p>If the call succeeds, <code class="docutils literal notranslate"><span class="pre">timer_create()</span></code> will return
0 (<code class="docutils literal notranslate"><span class="pre">OK</span></code>) and update the location referenced by <code class="docutils literal notranslate"><span class="pre">timerid</span></code> to a
<code class="docutils literal notranslate"><span class="pre">timer_t</span></code>, which can be passed to the other per-thread timer calls. If
an error occurs, the function will return a value of -1 (<code class="docutils literal notranslate"><span class="pre">ERROR</span></code>) and
set <code class="docutils literal notranslate"><span class="pre">errno</span></code> to indicate the error.</p>
<ul class="simple">
<li><p><code class="docutils literal notranslate"><span class="pre">EAGAIN</span></code>. The system lacks sufficient signal queuing resources to
honor the request.</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">EAGAIN</span></code>. The calling process has already created all of the timers
it is allowed by this implementation.</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">EINVAL</span></code>. The specified clock ID is not defined.</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">ENOTSUP</span></code>. The implementation does not support the creation of a
timer attached to the CPU-time clock that is specified by clock_id
and associated with a thread different thread invoking
timer_create().</p></li>
</ul>
</p>
</dd>
</dl>
<p><strong>POSIX Compatibility:</strong> Comparable to the POSIX interface of the same
name. Differences from the full POSIX implementation include:</p>
<ul class="simple">
<li><p>Only <code class="docutils literal notranslate"><span class="pre">CLOCK_REALTIME</span></code> is supported for the <code class="docutils literal notranslate"><span class="pre">clockid</span></code> argument.</p></li>
</ul>
</dd></dl>
<dl class="c function">
<dt id="c.timer_delete">
<span class="pre">int</span> <code class="sig-name descname"><span class="pre">timer_delete</span></code><span class="sig-paren">(</span><span class="pre">timer_t</span> <em><span class="pre">timerid</span></em><span class="sig-paren">)</span><span class="pre">;</span><a class="headerlink" href="#c.timer_delete" title="Permalink to this definition"></a><br /></dt>
<dd><p>Deletes the specified
timer, <code class="docutils literal notranslate"><span class="pre">timerid</span></code>, previously created by the <code class="docutils literal notranslate"><span class="pre">timer_create()</span></code>
function. If the timer is armed when <code class="docutils literal notranslate"><span class="pre">timer_delete()</span></code> is called, the
timer will be automatically disarmed before removal. The disposition of
pending signals for the deleted timer is unspecified.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>timerid</strong> – The pre-thread timer, previously created by the call to
timer_create(), to be deleted.</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p><p>If successful, the <code class="docutils literal notranslate"><span class="pre">timer_delete()</span></code> function will
return zero (<code class="docutils literal notranslate"><span class="pre">OK</span></code>). Otherwise, the function will return a value of -1
(<code class="docutils literal notranslate"><span class="pre">ERROR</span></code>) and set <code class="docutils literal notranslate"><span class="pre">errno</span></code> to indicate the error:</p>
<ul class="simple">
<li><p><code class="docutils literal notranslate"><span class="pre">EINVAL</span></code>. The timer specified timerid is not valid.</p></li>
</ul>
</p>
</dd>
</dl>
<p><strong>POSIX Compatibility:</strong> Comparable to the POSIX interface of the same
name.</p>
</dd></dl>
<dl class="c function">
<dt id="c.timer_settime">
<span class="pre">int</span> <code class="sig-name descname"><span class="pre">timer_settime</span></code><span class="sig-paren">(</span><span class="pre">timer_t</span> <em><span class="pre">timerid</span></em>, <span class="pre">int</span> <em><span class="pre">flags</span></em>, <em class="property"><span class="pre">const</span></em> <em class="property"><span class="pre">struct</span></em> <span class="pre">itimerspec</span> <span class="pre">*</span><em><span class="pre">value</span></em>, <em class="property"><span class="pre">struct</span></em> <span class="pre">itimerspec</span> <span class="pre">*</span><em><span class="pre">ovalue</span></em><span class="sig-paren">)</span><span class="pre">;</span><a class="headerlink" href="#c.timer_settime" title="Permalink to this definition"></a><br /></dt>
<dd><p>Sets the time until
the next expiration of the timer specified by <code class="docutils literal notranslate"><span class="pre">timerid</span></code> from the
<code class="docutils literal notranslate"><span class="pre">it_value</span></code> member of the value argument and arm the timer if the
<code class="docutils literal notranslate"><span class="pre">it_value</span></code> member of value is non-zero. If the specified timer was
already armed when <code class="docutils literal notranslate"><span class="pre">timer_settime()</span></code> is called, this call will reset
the time until next expiration to the value specified. If the
<code class="docutils literal notranslate"><span class="pre">it_value</span></code> member of value is zero, the timer will be disarmed. The
effect of disarming or resetting a timer with pending expiration
notifications is unspecified.</p>
<p>If the flag <code class="docutils literal notranslate"><span class="pre">TIMER_ABSTIME</span></code> is not set in the argument flags,
<code class="docutils literal notranslate"><span class="pre">timer_settime()</span></code> will behave as if the time until next expiration is
set to be equal to the interval specified by the <code class="docutils literal notranslate"><span class="pre">it_value</span></code> member of
value. That is, the timer will expire in <code class="docutils literal notranslate"><span class="pre">it_value</span></code> nanoseconds from
when the call is made. If the flag <code class="docutils literal notranslate"><span class="pre">TIMER_ABSTIME</span></code> is set in the
argument flags, <code class="docutils literal notranslate"><span class="pre">timer_settime()</span></code> will behave as if the time until
next expiration is set to be equal to the difference between the
absolute time specified by the <code class="docutils literal notranslate"><span class="pre">it_value</span></code> member of value and the
current value of the clock associated with <code class="docutils literal notranslate"><span class="pre">timerid</span></code>. That is, the
timer will expire when the clock reaches the value specified by the
<code class="docutils literal notranslate"><span class="pre">it_value</span></code> member of value. If the specified time has already passed,
the function will succeed and the expiration notification will be made.</p>
<p>The reload value of the timer will be set to the value specified by the
<code class="docutils literal notranslate"><span class="pre">it_interval</span></code> member of value. When a timer is armed with a non-zero
<code class="docutils literal notranslate"><span class="pre">it_interval</span></code>, a periodic (or repetitive) timer is specified.</p>
<p>Time values that are between two consecutive non-negative integer
multiples of the resolution of the specified timer will be rounded up to
the larger multiple of the resolution. Quantization error will not cause
the timer to expire earlier than the rounded time value.</p>
<p>If the argument <code class="docutils literal notranslate"><span class="pre">ovalue</span></code> is not NULL, the t<code class="docutils literal notranslate"><span class="pre">imer_settime()</span></code>
function will store, in the location referenced by <code class="docutils literal notranslate"><span class="pre">ovalue</span></code>, a value
representing the previous amount of time before the timer would have
expired, or zero if the timer was disarmed, together with the previous
timer reload value. Timers will not expire before their scheduled time.</p>
<p><strong>NOTE:</strong>At present, the <code class="docutils literal notranslate"><span class="pre">ovalue</span></code> argument is ignored.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>timerid</strong> – The pre-thread timer, previously created by the call to
timer_create(), to be be set.</p></li>
<li><p><strong>flags</strong> – Specify characteristics of the timer (see above)</p></li>
<li><p><strong>value</strong> – Specifies the timer value to set</p></li>
<li><p><strong>ovalue</strong> – A location in which to return the time remaining from the
previous timer setting (ignored).</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p><p>If the timer_gettime() succeeds, a value of 0
(<code class="docutils literal notranslate"><span class="pre">OK</span></code>) will be returned. If an error occurs, the value -1 (<code class="docutils literal notranslate"><span class="pre">ERROR</span></code>)
will be returned, and <code class="docutils literal notranslate"><span class="pre">`errno</span></code> &lt;#ErrnoAccess&gt;`__ set to indicate the
error.</p>
<ul class="simple">
<li><p><code class="docutils literal notranslate"><span class="pre">EINVAL</span></code>. The timerid argument does not correspond to an ID
returned by timer_create() but not yet deleted by timer_delete().</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">EINVAL</span></code>. A value structure specified a nanosecond value less than
zero or greater than or equal to 1000 million, and the it_value
member of that structure did not specify zero seconds and
nanoseconds.</p></li>
</ul>
</p>
</dd>
</dl>
<p><strong>POSIX Compatibility:</strong> Comparable to the POSIX interface of the same
name. Differences from the full POSIX implementation include:</p>
<ul class="simple">
<li><p>The <code class="docutils literal notranslate"><span class="pre">ovalue</span></code> argument is ignored.</p></li>
</ul>
</dd></dl>
<dl class="c function">
<dt id="c.timer_gettime">
<span class="pre">int</span> <code class="sig-name descname"><span class="pre">timer_gettime</span></code><span class="sig-paren">(</span><span class="pre">timer_t</span> <em><span class="pre">timerid</span></em>, <em class="property"><span class="pre">struct</span></em> <span class="pre">itimerspec</span> <span class="pre">*</span><em><span class="pre">value</span></em><span class="sig-paren">)</span><span class="pre">;</span><a class="headerlink" href="#c.timer_gettime" title="Permalink to this definition"></a><br /></dt>
<dd><p>Stores the amount
of time until the specified timer, <code class="docutils literal notranslate"><span class="pre">timerid</span></code>, expires and the reload
value of the timer into the space pointed to by the <code class="docutils literal notranslate"><span class="pre">value</span></code> argument.
The <code class="docutils literal notranslate"><span class="pre">it_value</span></code> member of this structure will contain the amount of
time before the timer expires, or zero if the timer is disarmed. This
value is returned as the interval until timer expiration, even if the
timer was armed with absolute time. The <code class="docutils literal notranslate"><span class="pre">it_interval</span></code> member of
<code class="docutils literal notranslate"><span class="pre">value</span></code> will contain the reload value last set by <code class="docutils literal notranslate"><span class="pre">timer_settime()</span></code>.</p>
<p>Due to the asynchronous operation of this function, the time reported by
this function could be significantly more than that actual time
remaining on the timer at any time.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>timerid</strong> – Specifies pre-thread timer, previously created by the
call to <code class="docutils literal notranslate"><span class="pre">timer_create()</span></code>, whose remaining count will be returned.</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p><p>If successful, the <code class="docutils literal notranslate"><span class="pre">timer_gettime()</span></code> function will
return zero (<code class="docutils literal notranslate"><span class="pre">OK</span></code>). Otherwise, an non-zero error number will be
returned to indicate the error:</p>
<ul class="simple">
<li><p><code class="docutils literal notranslate"><span class="pre">EINVAL</span></code>. The <code class="docutils literal notranslate"><span class="pre">timerid</span></code> argument does not correspond to an ID
returned by <code class="docutils literal notranslate"><span class="pre">timer_create()</span></code> but not yet deleted by
<code class="docutils literal notranslate"><span class="pre">timer_delete()</span></code>.</p></li>
</ul>
</p>
</dd>
</dl>
<p><strong>POSIX Compatibility:</strong> Comparable to the POSIX interface of the same
name.</p>
</dd></dl>
<dl class="c function">
<dt id="c.timer_getoverrun">
<span class="pre">int</span> <code class="sig-name descname"><span class="pre">timer_getoverrun</span></code><span class="sig-paren">(</span><span class="pre">timer_t</span> <em><span class="pre">timerid</span></em><span class="sig-paren">)</span><span class="pre">;</span><a class="headerlink" href="#c.timer_getoverrun" title="Permalink to this definition"></a><br /></dt>
<dd><p>Only a single signal will be queued to the process for
a given timer at any point in time. When a timer for which a signal is
still pending expires, no signal will be queued, and a timer overrun
will occur. When a timer expiration signal is delivered to or accepted
by a process, if the implementation supports the <em>Realtime Signals
Extension</em>, the <code class="docutils literal notranslate"><span class="pre">timer_getoverrun()</span></code> function will return the timer
expiration overrun count for the specified timer. The overrun count
returned contains the number of extra timer expirations that occurred
between the time the signal was generated (queued) and when it was
delivered or accepted, up to but not including an implementation-defined
maximum of <code class="docutils literal notranslate"><span class="pre">DELAYTIMER_MAX</span></code>. If the number of such extra expirations
is greater than or equal to <code class="docutils literal notranslate"><span class="pre">DELAYTIMER_MAX</span></code>, then the overrun count
will be set to <code class="docutils literal notranslate"><span class="pre">DELAYTIMER_MAX</span></code>. The value returned by
<code class="docutils literal notranslate"><span class="pre">timer_getoverrun()</span></code> will apply to the most recent expiration signal
delivery or acceptance for the timer. If no expiration signal has been
delivered for the timer, or if the <em>Realtime Signals Extension</em> is not
supported, the return value of <code class="docutils literal notranslate"><span class="pre">timer_getoverrun()</span></code> is unspecified.</p>
<p><strong>NOTE:</strong> This interface is not currently implemented in NuttX.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>timerid</strong> – Specifies pre-thread timer, previously created by the
call to <code class="docutils literal notranslate"><span class="pre">timer_create()</span></code>, whose overrun count will be returned.</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p><p>If the <code class="docutils literal notranslate"><span class="pre">timer_getoverrun()</span></code> function succeeds, it
will return the timer expiration overrun count as explained above.
<code class="docutils literal notranslate"><span class="pre">timer_getoverrun()</span></code> will fail if:</p>
<ul class="simple">
<li><p><code class="docutils literal notranslate"><span class="pre">EINVAL</span></code>. The <code class="docutils literal notranslate"><span class="pre">timerid</span></code> argument does not correspond to an ID
returned by <code class="docutils literal notranslate"><span class="pre">timer_create()</span></code> but not yet deleted by
<code class="docutils literal notranslate"><span class="pre">timer_delete()</span></code>.</p></li>
</ul>
</p>
</dd>
</dl>
<p><strong>POSIX Compatibility:</strong> Comparable to the POSIX interface of the same
name. Differences from the full POSIX implementation include:</p>
<ul class="simple">
<li><p>This interface is not currently implemented by NuttX.</p></li>
</ul>
<p><strong>Assumptions/Limitations:</strong></p>
<p><strong>POSIX Compatibility:</strong> Comparable to the POSIX interface of the same
name.</p>
</dd></dl>
<dl class="c function">
<dt id="c.gettimeofday">
<span class="pre">int</span> <code class="sig-name descname"><span class="pre">gettimeofday</span></code><span class="sig-paren">(</span><em class="property"><span class="pre">struct</span></em> <span class="pre">timeval</span> <span class="pre">*</span><em><span class="pre">tp</span></em>, <span class="pre">void</span> <span class="pre">*</span><em><span class="pre">tzp</span></em><span class="sig-paren">)</span><span class="pre">;</span><a class="headerlink" href="#c.gettimeofday" title="Permalink to this definition"></a><br /></dt>
<dd><p>This implementation of <code class="docutils literal notranslate"><span class="pre">gettimeofday()</span></code> is simply a
thin wrapper around <a class="reference internal" href="#c.clock_gettime" title="clock_gettime"><code class="xref c c-func docutils literal notranslate"><span class="pre">clock_gettime()</span></code></a>. It simply
calls <code class="docutils literal notranslate"><span class="pre">clock_gettime()</span></code> using the <code class="docutils literal notranslate"><span class="pre">CLOCK_REALTIME</span></code> timer and
converts the result to the required <code class="docutils literal notranslate"><span class="pre">struct</span> <span class="pre">timeval</span></code>.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>tp</strong> – The current time will be returned to this user provided
location.</p></li>
<li><p><strong>tzp</strong> – A reference to the timezone – <em>IGNORED</em>.</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>See <a class="reference internal" href="#c.clock_gettime" title="clock_gettime"><code class="xref c c-func docutils literal notranslate"><span class="pre">clock_gettime()</span></code></a>.</p>
</dd>
</dl>
</dd></dl>
<dl class="c function">
<dt id="c.gethrtime">
<span class="pre">hrtime_t</span> <code class="sig-name descname"><span class="pre">gethrtime</span></code><span class="sig-paren">(</span><span class="pre">void</span><span class="sig-paren">)</span><span class="pre">;</span><a class="headerlink" href="#c.gethrtime" title="Permalink to this definition"></a><br /></dt>
<dd><p>This implementation of <code class="docutils literal notranslate"><span class="pre">gethrtime()</span></code> is simply a
thin wrapper around <a class="reference internal" href="#c.clock_gettime" title="clock_gettime"><code class="xref c c-func docutils literal notranslate"><span class="pre">clock_gettime()</span></code></a>. It simply
calls <code class="docutils literal notranslate"><span class="pre">clock_gettime()</span></code> using the <code class="docutils literal notranslate"><span class="pre">CLOCK_REALTIME</span></code> or <code class="docutils literal notranslate"><span class="pre">CLOCK_MONOTONIC</span></code>,
and converts the result to the required hrtime_t.</p>
<dl class="field-list simple">
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>current system time in ns</p>
</dd>
</dl>
</dd></dl>
</div>
</div>
</div>
<footer>
<div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
<a href="07_signals.html" class="btn btn-neutral float-right" title="Signal Interfaces" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
<a href="05_counting_semaphore.html" class="btn btn-neutral float-left" title="Counting Semaphore Interfaces" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
</div>
<hr/>
<div role="contentinfo">
<p>
&#169; Copyright 2020, The Apache Software Foundation.
</p>
</div>
</footer>
</div>
</div>
</section>
</div>
<script type="text/javascript">
jQuery(function () {
SphinxRtdTheme.Navigation.enable(true);
});
</script>
</body>
</html>