Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 36 lines (31 sloc) 1.177 kB
69d4044 @mbsmith Added modelines to source files.
mbsmith authored
1 /* vim: set expandtab ts=4 sw=4: */
9aa22fe Offered permission to copy under gplv3 license.
cjdelisle authored
2 /*
3 * You may redistribute this program and/or modify it under the terms of
4 * the GNU General Public License as published by the Free Software Foundation,
5 * either version 3 of the License, or (at your option) any later version.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 *
12 * You should have received a copy of the GNU General Public License
13 * along with this program. If not, see <http://www.gnu.org/licenses/>.
14 */
547f4a3 Cleaned up a bunch of files, added a codestyle validator and some inf…
cjdelisle authored
15 #ifndef Time_H
16 #define Time_H
17
78172a7 periodic code dump
cjdelisle authored
18 #include <sys/time.h>
1e9a7cf Killed ping-from-the-past bug, also made all time calls use libevent …
cjdelisle authored
19 #include <event2/event.h>
78172a7 periodic code dump
cjdelisle authored
20
1e9a7cf Killed ping-from-the-past bug, also made all time calls use libevent …
cjdelisle authored
21 static inline uint64_t Time_currentTimeMilliseconds(struct event_base* eventBase)
78172a7 periodic code dump
cjdelisle authored
22 {
1e9a7cf Killed ping-from-the-past bug, also made all time calls use libevent …
cjdelisle authored
23 struct timeval now;
24 event_base_gettimeofday_cached(eventBase, &now);
25 return (((uint64_t) now.tv_sec) * 1024) + (now.tv_usec / 1024);
26 }
27
28 static inline uint64_t Time_currentTimeSeconds(struct event_base* eventBase)
29 {
30 struct timeval now;
31 event_base_gettimeofday_cached(eventBase, &now);
32 return (uint64_t) now.tv_sec;
78172a7 periodic code dump
cjdelisle authored
33 }
547f4a3 Cleaned up a bunch of files, added a codestyle validator and some inf…
cjdelisle authored
34
35 #endif
Something went wrong with that request. Please try again.