Browse files

* More elegant fix.

  • Loading branch information...
1 parent 3268269 commit 1c092f46255b4dfaf9a452b0b0d5aae6f199b36f @bobbens committed Apr 10, 2011
Showing with 13 additions and 1 deletion.
  1. +1 −1 src/nlua_pilot.c
  2. +11 −0 src/ntime.c
  3. +1 −0 src/ntime.h
View
2 src/nlua_pilot.c
@@ -2366,7 +2366,7 @@ static int pilotL_getStats( lua_State *L )
PUSH_DOUBLE( L, "jam_range", p->jam_range );
PUSH_DOUBLE( L, "jam_chance", p->jam_chance );
/* Stats. */
- PUSH_DOUBLE( L, "jump_delay", pilot_hyperspaceDelay(p) / pow(10, 3) );
+ PUSH_DOUBLE( L, "jump_delay", ntime_convertSTU( pilot_hyperspaceDelay(p) ) );
return 1;
}
View
11 src/ntime.c
@@ -157,6 +157,17 @@ int ntime_getSTU( ntime_t t )
/**
+ * @brief Converts the time to STU.
+ * @param t Time to convert.
+ * @return Time in STU.
+ */
+double ntime_convertSTU( ntime_t t )
+{
+ return ((double)t / (double)NT_STU_DIV);
+}
+
+
+/**
* @brief Gets the remainder.
*/
double ntime_getRemainder( ntime_t t )
View
1 src/ntime.h
@@ -28,6 +28,7 @@ void ntime_getR( int *scu, int *stp, int *stu, double *rem );
int ntime_getSCU( ntime_t t );
int ntime_getSTP( ntime_t t );
int ntime_getSTU( ntime_t t );
+double ntime_convertSTU( ntime_t t );
double ntime_getRemainder( ntime_t t );
char* ntime_pretty( ntime_t t, int d );
void ntime_prettyBuf( char *str, int max, ntime_t t, int d );

0 comments on commit 1c092f4

Please sign in to comment.