Author Topic: Why do Missiontime and timestamp() diverge?  (Read 5431 times)

0 Members and 1 Guest are viewing this topic.

Offline zookeeper

  • *knock knock* Who's there? Poe. Poe who?
  • 210
Re: Why do Missiontime and timestamp() diverge?
Here's windows trunk builds (release and debug, SSE2) with the above patch applied.

EDIT: Forgot to mention that I added this to fix.h make it compile on MSVC++ 2010 Express:

Code: [Select]
#ifdef _MSC_VER
#include "globalincs/msvc/stdint.h"
#else
#include <stdint.h>
#endif
« Last Edit: December 16, 2011, 10:41:24 am by zookeeper »

 

Offline Eli2

  • 26
Re: Why do Missiontime and timestamp() diverge?
Ok, here is another patch, so that scripting gets its time from the better source.

Code: [Select]
Index: code/parse/lua.cpp
===================================================================
--- code/parse/lua.cpp
+++ code/parse/lua.cpp
@@ -11907,7 +11907,9 @@ ADE_FUNC(getMissionTime, l_Mission, NULL, "Game time in seconds since the missio
  if(!(Game_mode & GM_IN_MISSION))
  return ade_set_error(L, "f", 0.0f);
 
- return ade_set_args(L, "x", Missiontime);
+ double time = (double)timestamp() / 1000.0;
+
+ return ade_set_args(L, "d", time);
 }
 
 //WMC - These are in freespace.cpp

 

Offline zookeeper

  • *knock knock* Who's there? Poe. Poe who?
  • 210
Re: Why do Missiontime and timestamp() diverge?
I've been testing this patch for months now myself, so at least for me it works just fine. Since this fix is needed by FotG ASAP, I'd like to get this in unless there's any particular objections.

  

Offline Goober5000

  • HLP Loremaster
  • Moderator
  • 214
    • Goober5000 Productions
Re: Why do Missiontime and timestamp() diverge?
Now why couldn't I find this thread when I was looking all over for it yesterday? :sigh:

Jg18 was on the #scp channel in IRC yesterday and he was experiencing some problems that may have been due to this.  I'll point him over this way.