-/* Copyright (c) 2008 The Board of Trustees of The Leland Stanford
+/* Copyright (c) 2008, 2009 The Board of Trustees of The Leland Stanford
* Junior University
*
* We are making the OpenFlow specification and associated documentation
return (long long int) now.tv_sec * 1000 + now.tv_usec / 1000;
}
+/* Stores the current time, accurate within TIME_UPDATE_INTERVAL ms, into
+ * '*tv'. */
+void
+time_timeval(struct timeval *tv)
+{
+ refresh_if_ticked();
+ *tv = now;
+}
+
/* Configures the program to die with SIGALRM 'secs' seconds from now, if
* 'secs' is nonzero, or disables the feature if 'secs' is zero. */
void
-/* Copyright (c) 2008 The Board of Trustees of The Leland Stanford
+/* Copyright (c) 2008, 2009 The Board of Trustees of The Leland Stanford
* Junior University
*
* We are making the OpenFlow specification and associated documentation
#include "util.h"
struct pollfd;
+struct timeval;
/* POSIX allows floating-point time_t, but we don't support it. */
BUILD_ASSERT_DECL(TYPE_IS_INTEGER(time_t));
void time_refresh(void);
time_t time_now(void);
long long int time_msec(void);
+void time_timeval(struct timeval *);
void time_alarm(unsigned int secs);
int time_poll(struct pollfd *, int n_pollfds, int timeout);