<p>Nicola Corna has uploaded this change for <strong>review</strong>.</p><p><a href="https://review.coreboot.org/21011">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">libpayload: add time()<br><br>Change-Id: I97e393537ccc71ea454bb0d6cdbbb7ed32485f1e<br>---<br>M payloads/libpayload/include/time.h<br>M payloads/libpayload/libc/time.c<br>2 files changed, 21 insertions(+), 6 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://review.coreboot.org:29418/coreboot refs/changes/11/21011/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">diff --git a/payloads/libpayload/include/time.h b/payloads/libpayload/include/time.h<br>index 25f476c..8871824 100644<br>--- a/payloads/libpayload/include/time.h<br>+++ b/payloads/libpayload/include/time.h<br>@@ -44,6 +44,7 @@<br>         suseconds_t tv_usec; /**< Microseconds */<br> };<br> <br>+time_t time (time_t* tloc);<br> int gettimeofday(struct timeval *tv, void *tz);<br> /** @} */<br> <br>diff --git a/payloads/libpayload/libc/time.c b/payloads/libpayload/libc/time.c<br>index 4ed788f..cfad278 100644<br>--- a/payloads/libpayload/libc/time.c<br>+++ b/payloads/libpayload/libc/time.c<br>@@ -121,13 +121,12 @@<br> #endif<br> <br> /**<br>- * Return the current time broken into a timeval structure.<br>+ * Return the current time.<br>  *<br>- * @param tv A pointer to a timeval structure.<br>- * @param tz Added for compatability - not used.<br>- * @return 0 for success (this function cannot return non-zero currently).<br>+ * @param tloc When not NULL, set this variable to the current time.<br>+ * @return The current time.<br>  */<br>-int gettimeofday(struct timeval *tv, void *tz)<br>+time_t time (time_t* tloc)<br> {<br>     /*<br>     * Call the gtod init when we need it - this keeps the code from<br>@@ -138,7 +137,22 @@<br> <br>     update_clock();<br> <br>-   tv->tv_sec = clock.secs;<br>+  if (tloc)<br>+            *tloc = clock.secs;<br>+<br>+       return clock.secs;<br>+}<br>+<br>+/**<br>+ * Return the current time broken into a timeval structure.<br>+ *<br>+ * @param tv A pointer to a timeval structure.<br>+ * @param tz Added for compatability - not used.<br>+ * @return 0 for success (this function cannot return non-zero currently).<br>+ */<br>+int gettimeofday(struct timeval *tv, void *tz)<br>+{<br>+       tv->tv_sec = time(NULL);<br>   tv->tv_usec = clock.usecs;<br> <br>      return 0;<br></pre><p>To view, visit <a href="https://review.coreboot.org/21011">change 21011</a>. To unsubscribe, visit <a href="https://review.coreboot.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://review.coreboot.org/21011"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: coreboot </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>
<div style="display:none"> Gerrit-Change-Id: I97e393537ccc71ea454bb0d6cdbbb7ed32485f1e </div>
<div style="display:none"> Gerrit-Change-Number: 21011 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Nicola Corna <nicola@corna.info> </div>