OSDN Git Service

2013.10.24
[uclinux-h8/uClinux-dist.git] / user / hping / getusec.c
1 /* 
2  * $smu-mark$ 
3  * $name: getusec.c$ 
4  * $author: Salvatore Sanfilippo <antirez@invece.org>$ 
5  * $copyright: Copyright (C) 1999 by Salvatore Sanfilippo$ 
6  * $license: This software is under GPL version 2 of license$ 
7  * $date: Fri Nov  5 11:55:47 MET 1999$ 
8  * $rev: 8$ 
9  */ 
10
11 /* $Id: getusec.c,v 1.2 2003/09/01 00:22:06 antirez Exp $ */
12
13 #include <sys/time.h>
14 #include <stdlib.h>
15
16 time_t get_usec(void)
17 {
18         struct timeval tmptv;
19
20         gettimeofday(&tmptv, NULL);
21         return tmptv.tv_usec;
22 }
23
24 time_t milliseconds(void)
25 {
26         struct timeval tv;
27         gettimeofday(&tv, NULL);
28         return ((tv.tv_sec % 86400) * 1000 + tv.tv_usec / 1000);
29 }