world->info.timezone = 0.0f;
}
- time_t t;
- struct tm *tm;
- time( &t );
- tm = gmtime( &t );
- world->time = (float)tm->tm_min/20.0f + (world->info.timezone/24.0f);
+ time_t seconds = time(NULL) % ((u32)k_day_length*60);
+ world->time = ((f64)(seconds)/(k_day_length*60.0));
+ world->time += (world->info.timezone/24.0);
/* process resources from pack */
world_gen_load_surfaces( world );
#include "respawn.h"
static int ccmd_set_time( int argc, const char *argv[] ){
- if( argc == 1 ){
- world_instance *world = world_current_instance();
+ world_instance *world = world_current_instance();
+ if( argc == 1 )
world->time = atof( argv[0] );
- }
- else {
- vg_error( "Usage set_time <0-1.0>\n" );
- }
+ else
+ vg_error( "Usage set_time <0-1.0> (current time: %f)\n", world->time );
return 0;
}
}
}
-static void world_prerender( world_instance *world )
-{
-
+static void world_prerender( world_instance *world ){
if( mdl_arrcount( &world->ent_light ) ){
f32 rate = vg_maxf(0.1f, fabsf(k_day_length)) * vg_signf(k_day_length);
- world->time += vg.time_delta * (1.0/(rate*60.0));
+ world->time += vg.time_frame_delta * (1.0/(rate*60.0));
}
else{
world->time = 0.834;