File: Clock.hh

package info (click to toggle)
log4shib 1.0.9-3~bpo7%2B1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy-backports-sloppy
  • size: 4,244 kB
  • sloc: cpp: 4,767; sh: 4,210; ansic: 818; makefile: 268
file content (42 lines) | stat: -rw-r--r-- 851 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/* $Id: Clock.hh,v 1.5 2002/09/15 22:40:50 bastiaan Exp $
 * 
 * See the COPYING file for the terms of usage and distribution.
 */

#ifndef __CLOCK_H
#define __CLOCK_H

#ifdef LOG4SHIB_HAVE_STDINT_H
#include <stdint.h>
#endif // LOG4SHIB_HAVE_STDINT_H

#ifdef __osf__
    typedef long usec_t;    /* number of microseconds since 1970/01/01 */
#   define INT64_CONSTANT(val)  (val##L)
#else
    typedef int64_t usec_t;
#   define INT64_CONSTANT(val)  (val##LL)
#endif

class Clock
{
public:
    static bool		UsingCPU;
    static usec_t 	time(void);

    			Clock(void);
    			~Clock(void);

    bool		active(void) const { return _active; }
    usec_t		elapsed(void) const;
    usec_t		start(void);
    usec_t		reset(void) { return start(); }
    usec_t		stop(void);

private:
    usec_t		_start;    
    usec_t		_elapsed;
    bool		_active;
};

#endif