ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/libio/misc/misc.c
(Generate patch)

Comparing:
ircd-hybrid/src/s_misc.c (file contents), Revision 31 by knight, Sun Oct 2 20:34:05 2005 UTC vs.
ircd-hybrid/libio/misc/misc.c (file contents), Revision 69 by adx, Tue Oct 4 16:09:51 2005 UTC

# Line 23 | Line 23
23   */
24  
25   #include "stdinc.h"
26 #include "s_misc.h"
27 #include "client.h"
28 #include "common.h"
29 #include "irc_string.h"
30 #include "sprintf_irc.h"
31 #include "ircd.h"
32 #include "numeric.h"
33 #include "irc_res.h"
34 #include "fdlist.h"
35 #include "s_bsd.h"
36 #include "s_conf.h"
37 #include "s_serv.h"
38 #include "send.h"
39 #include "memory.h"
26  
27 + struct timeval SystemTime;
28  
29   static const char *months[] =
30   {
# Line 168 | Line 155 | ssl_get_cipher(SSL *ssl)
155    return buffer;
156   }
157   #endif
158 +
159 + void
160 + set_time(void)
161 + {
162 +  struct timeval newtime;
163 + #ifdef _WIN32
164 +  FILETIME ft;
165 +
166 +  GetSystemTimeAsFileTime(&ft);
167 +  if (ft.dwLowDateTime < 0xd53e8000)
168 +    ft.dwHighDateTime--;
169 +  ft.dwLowDateTime -= 0xd53e8000;
170 +  ft.dwHighDateTime -= 0x19db1de;
171 +
172 +  newtime.tv_sec  = (*(uint64_t *) &ft) / 10000000;
173 +  newtime.tv_usec = (*(uint64_t *) &ft) / 10 % 1000000;
174 + #else
175 +  newtime.tv_sec  = 0;
176 +  newtime.tv_usec = 0;
177 +  gettimeofday(&newtime, NULL);
178 + #endif
179 +
180 +  if (newtime.tv_sec < CurrentTime)
181 +  {
182 +    ilog(L_CRIT, "System clock is running backwards - (%lu < %lu)",
183 +         (unsigned long)newtime.tv_sec, (unsigned long)CurrentTime);
184 +    set_back_events(CurrentTime - newtime.tv_sec);
185 +  }
186 +
187 +  SystemTime.tv_sec  = newtime.tv_sec;
188 +  SystemTime.tv_usec = newtime.tv_usec;
189 + }

Comparing:
ircd-hybrid/src/s_misc.c (property svn:keywords), Revision 31 by knight, Sun Oct 2 20:34:05 2005 UTC vs.
ircd-hybrid/libio/misc/misc.c (property svn:keywords), Revision 69 by adx, Tue Oct 4 16:09:51 2005 UTC

# Line 1 | Line 1
1 < "Id Revision"
1 > Id Revision

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines