source: golgotha/src/i4/time/saturn_time.cc @ 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.5 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#ifdef _SATURN
10extern "C"
11{
12
13#include "sgl.h"
14
15};
16#endif
17
18#include "time/time.hh"
19
20
21i4_time_class::i4_time_class()
22{
23  w32 *sec_usec=(w32 *)private_data;
24
25  sec_usec[0]=Smpc_Status->rtc.second +
26    Smpc_Status->rtc.minute*60 +
27    Smpc_Status->rtc.hour*60*60;
28  sec_usec[1]=0;
29}
30
31
32
33bool i4_time_class::operator <(const i4_time_class &other) const
34{
35  w32 *me_t=(w32 *)private_data;
36  w32 *other_t=(w32 *)other.private_data;
37  return (other_t[0]<me_t[0] || (other_t[0]==me_t[0] &&  other_t[1]<me_t[1]));
38}
39
40
41
42bool i4_time_class::operator >(const i4_time_class &other) const
43{
44  w32 *me_t=(w32 *)private_data;
45  w32 *other_t=(w32 *)other.private_data;
46  return (other_t[0]>me_t[0] || (other_t[0]==me_t[0] &&  other_t[1]>me_t[1]));
47}
48
49
50sw32 i4_time_class::milli_diff(const i4_time_class &past_time) const
51{
52  w32 *me_t=(w32 *)private_data;
53  w32 *past_t=(w32 *)past_time.private_data;
54
55  return ((sw32)me_t[1]-(sw32)past_t[1])/1000+(me_t[0]-past_t[0])*1000;
56}
57
Note: See TracBrowser for help on using the repository browser.