source: zzuf/trunk/src/timer.c @ 1657

Last change on this file since 1657 was 1657, checked in by Sam Hocevar, 13 years ago
  • Change timing functions to gettimeofday() instead of time() for more precision.
  • Property svn:keywords set to Id
File size: 857 bytes
Line 
1/*
2 *  zzuf - general purpose fuzzer
3 *  Copyright (c) 2006 Sam Hocevar <sam@zoy.org>
4 *                All Rights Reserved
5 *
6 *  $Id: timer.c 1657 2007-01-12 15:47:48Z sam $
7 *
8 *  This program is free software. It comes without any warranty, to
9 *  the extent permitted by applicable law. You can redistribute it
10 *  and/or modify it under the terms of the Do What The Fuck You Want
11 *  To Public License, Version 2, as published by Sam Hocevar. See
12 *  http://sam.zoy.org/wtfpl/COPYING for more details.
13 */
14
15/*
16 *  timer.c: timing functions
17 */
18
19#include "config.h"
20
21#if defined HAVE_STDINT_H
22#   include <stdint.h>
23#elif defined HAVE_INTTYPES_H
24#   include <inttypes.h>
25#endif
26#include <stdio.h>
27#include <sys/time.h>
28#include <time.h>
29
30#include "timer.h"
31
32int64_t _zz_time(void)
33{
34    struct timeval tv;
35    gettimeofday(&tv, NULL);
36    return (int64_t)tv.tv_sec * 1000000 + tv.tv_usec;
37}
38
Note: See TracBrowser for help on using the repository browser.