aboutsummaryrefslogtreecommitdiffstats
path: root/Attic/timer/timer.h
blob: 603027f6d5593f8f6bd7319ce62f115760a5d8d3 (plain)
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
43
44
45
46
47
48
49
50
51
52
53
/**
* Timestamp Functions
* (C) 1999-2009 Jack Lloyd
*
* Distributed under the terms of the Botan license
*/

#ifndef BOTAN_TIMERS_H__
#define BOTAN_TIMERS_H__

#include <botan/rng.h>
#include <ctime>

namespace Botan {

/*
* Time Access/Conversion Functions
*/
BOTAN_DLL u64bit system_time();

BOTAN_DLL std::tm time_t_to_tm(u64bit);

/**
* Timer Interface
*/
class BOTAN_DLL Timer : public EntropySource
   {
   public:
      /**
      @return nanoseconds resolution timestamp, unknown epoch
      */
      virtual u64bit clock() const = 0;

      void poll(Entropy_Accumulator& accum);

      virtual ~Timer() {}
   protected:
      static u64bit combine_timers(u32bit, u32bit, u32bit);
   };

/**
* ANSI Clock Timer
*/
class BOTAN_DLL ANSI_Clock_Timer : public Timer
   {
   public:
      std::string name() const { return "ANSI clock"; }
      u64bit clock() const;
   };

}

#endif