Disco
Joined: 06 Dec 2006 Posts: 152
|
Posted: Wed Sep 19, 2007 12:02 Post subject: Time.... |
|
|
For some background info, see : http://www.nwnx.org/phpBB2/viewtopic.php?t=723
This is about NWN1, though.
I use something like this as a runtime counter in seconds:
Code: | sDateTime = IntToString(date.year);
sDateTime += ":" + IntToString(date.month);
sDateTime += ":" + IntToString(date.day);
sDateTime += ":" + IntToString(date.hour);
sDateTime += ":" + IntToString(date.minute);
sDateTime += ":" + IntToString(date.second);
|
I use this to track the amount of time a PC spends on our server. At this moment this is done by making a database write every time a player changes areas. Anyway, I use the runtime counter to do this in a bit more efficient manner and have the login time also available in game without checking the database. At this moment I have both the new and the old system running parallel to check the results.
One thing I discovered is that the times recorded in MySQL are not equal to the times given by the counter above. After placing a few tracers I spotted this...
format: MySQL time - log message ( real time according to NWN )
2007-09-18 17:07:19 - Server Start
2007-09-18 18:00:11 - RunTime 4375 secs ( 18:20:50 )
2007-09-18 20:53:19 - Runtime 14763 secs ( 21:13:24 )
2007-09-18 20:55:40 - Server Start
2007-09-18 22:03:55 - Runtime 4097 secs ( 22:04:08 )
2007-09-19 00:37:14 - Runtime 13296 secs ( 00:37:40 )
2007-09-19 00:48:54 - Server Start
2007-09-19 02:21:08 - Runtime 5537 secs ( 02:21:22 )
2007-09-19 04:02:16 - Runtime 11605 secs ( 04:02:37 )
The first one is wacky. Our server gets a reset every 4 hours, effectively closing down the module at 03:53 hours of runtime. The first one has an internal time over 4 hours at the last measurement! The whole procedure is 20 minutes off within 10 minutes after the reset and stays that way.
The next logs are quite OK. The start of the runtimer and the logging of the server start aren't in the same function, so a few seconds is nothing I worry about.
Anyway, whatever the cause... it does suggest that the internal NWN clock isn't too reliable. |
|