source: golgotha/src/i4/time/time.hh @ 80

Last change on this file since 80 was 80, checked in by Sam Hocevar, 12 years ago
  • Adding the Golgotha source code. Not sure what's going to be interesting in there, but since it's all public domain, there's certainly stuff to pick up.
File size: 1.6 KB
Line 
1/********************************************************************** <BR>
2  This file is part of Crack dot Com's free source code release of
3  Golgotha. <a href="http://www.crack.com/golgotha_release"> <BR> for
4  information about compiling & licensing issues visit this URL</a>
5  <PRE> If that doesn't help, contact Jonathan Clark at
6  golgotha_source@usa.net (Subject should have "GOLG" in it)
7***********************************************************************/
8
9#ifndef __i4TIME_HPP_
10#define __i4TIME_HPP_
11
12#include "arch.hh"
13 
14#include <stdlib.h>
15#include <string.h>
16
17class i4_time_class
18{
19  union
20  {
21    struct
22    {
23      sw32 sec, usec;
24    } unix_time;
25
26    struct
27    {
28      sw32 clock;
29      sw32 overflow;
30    } win32_time;
31  } time;
32 
33public:
34
35  i4_time_class(sw32 milli_sec);
36
37
38  i4_bool operator <(const i4_time_class &other) const;
39  i4_bool operator >(const i4_time_class &other) const;
40
41  // copies the time from another previously created i4_time_class
42  i4_time_class(const i4_time_class &ref)
43  {
44    time=ref.time;
45  }
46
47  void get();    // gets the time from the system
48
49  void add_milli(sw32 milli_sec);
50
51  i4_time_class()
52  { get(); }
53
54  sw32 milli_diff(const i4_time_class &past_time) const; 
55  // returns difference between our time and a past time in 1/1000th of a second
56};
57
58w64 i4_get_system_clock();
59int i4_get_clocks_per_second();
60
61void i4_sleep(int seconds);
62void i4_milli_sleep(int milli_seconds);   // 1/100th of a seconds
63
64#endif
65
66//{{{ Emacs Locals
67// Local Variables:
68// folded-file: t
69// End:
70//}}}
Note: See TracBrowser for help on using the repository browser.