2
0
mirror of https://github.com/boostorg/build.git synced 2026-02-17 01:32:12 +00:00

Boost Jam code cleanup - extracted code for getting a timestamp for the current system time to timestamp_current().

[SVN r79507]
This commit is contained in:
Jurko Gospodnetić
2012-07-14 17:28:50 +00:00
parent ace6747054
commit 0ff040d3a0
5 changed files with 11 additions and 4 deletions

View File

@@ -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;
}

View File

@@ -388,7 +388,7 @@ int main( int argc, char * * argv, char * * arg_environ )
/* Set JAMDATE. */
{
timestamp current;
timestamp_init( &current, time( 0 ), 0 );
timestamp_current( &current );
var_set( root_module(), constant_JAMDATE, list_new( outf_time(
&current ) ), VAR_SET );
}

View File

@@ -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 );
}

View File

@@ -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;

View File

@@ -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