diff --git a/v2/engine/execunix.c b/v2/engine/execunix.c index 140dee8ae..904743a8e 100644 --- a/v2/engine/execunix.c +++ b/v2/engine/execunix.c @@ -184,7 +184,7 @@ void exec_cmd /* Start the command */ - timestamp_init( &cmdtab[ slot ].start_dt, time( 0 ), 0 ); + timestamp_current( &cmdtab[ slot ].start_dt ); if ( 0 < globs.timeout ) { @@ -506,7 +506,7 @@ void exec_wait() time_info.user = (double)( new_time.tms_cutime - old_time.tms_cutime ) / CLOCKS_PER_SEC; timestamp_copy( &time_info.start, &cmdtab[ i ].start_dt ); - timestamp_init( &time_info.end, time( 0 ), 0 ); + timestamp_current( &time_info.end ); old_time = new_time; } diff --git a/v2/engine/jam.c b/v2/engine/jam.c index 6277320d3..f6b838738 100644 --- a/v2/engine/jam.c +++ b/v2/engine/jam.c @@ -388,7 +388,7 @@ int main( int argc, char * * argv, char * * arg_environ ) /* Set JAMDATE. */ { timestamp current; - timestamp_init( ¤t, time( 0 ), 0 ); + timestamp_current( ¤t ); var_set( root_module(), constant_JAMDATE, list_new( outf_time( ¤t ) ), VAR_SET ); } diff --git a/v2/engine/make1.c b/v2/engine/make1.c index 1ab67a7ca..d4d874b82 100644 --- a/v2/engine/make1.c +++ b/v2/engine/make1.c @@ -513,7 +513,7 @@ static void make1c( state const * const pState ) if ( globs.noexec || cmd->noop ) { timing_info time_info = { 0 }; - timestamp_init( &time_info.start, time( 0 ), 0 ); + timestamp_current( &time_info.start ); timestamp_copy( &time_info.end, &time_info.start ); make1c_closure( t, EXEC_CMD_OK, &time_info, "", "", EXIT_OK ); } diff --git a/v2/engine/timestamp.c b/v2/engine/timestamp.c index db400c6e1..81fefcaec 100644 --- a/v2/engine/timestamp.c +++ b/v2/engine/timestamp.c @@ -90,6 +90,12 @@ void timestamp_copy( timestamp * const target, timestamp const * const source ) } +void timestamp_current( timestamp * const t ) +{ + timestamp_init( t, time( 0 ), 0 ); +} + + int timestamp_empty( timestamp const * const time ) { return !time->secs && !time->nsecs; diff --git a/v2/engine/timestamp.h b/v2/engine/timestamp.h index 66e9af128..80d6fd8df 100644 --- a/v2/engine/timestamp.h +++ b/v2/engine/timestamp.h @@ -24,6 +24,7 @@ typedef struct timestamp void timestamp_clear( timestamp * const time ); int timestamp_cmp( timestamp const * const lhs, timestamp const * const rhs ); void timestamp_copy( timestamp * const target, timestamp const * const source ); +void timestamp_current( timestamp * const time ); int timestamp_empty( timestamp const * const time ); void timestamp_from_path( timestamp * const time, OBJECT * const path ); void timestamp_init( timestamp * const time, time_t const secs, int const nsecs