Skip to content

Commit

Permalink
Refactor ssl_context_info time printing
Browse files Browse the repository at this point in the history
Signed-off-by: Andrzej Kurek <[email protected]>
  • Loading branch information
Andrzej Kurek committed Mar 2, 2022
1 parent 2f87958 commit 3f0c37e
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions programs/ssl/ssl_context_info.c
Original file line number Diff line number Diff line change
Expand Up @@ -301,11 +301,11 @@ void print_hex( const uint8_t *b, size_t len,
/*
* Print the value of time_t in format e.g. 2020-01-23 13:05:59
*/
#if defined(MBEDTLS_HAVE_TIME)
void print_time( const time_t *time )
void print_time( const uint64_t *time )
{
#if defined(MBEDTLS_HAVE_TIME)
char buf[20];
struct tm *t = gmtime( time );
struct tm *t = gmtime( (time_t*) time );
static const char format[] = "%Y-%m-%d %H:%M:%S";
if( NULL != t )
{
Expand All @@ -316,8 +316,11 @@ void print_time( const time_t *time )
{
printf( "unknown\n" );
}
}
#else
(void) time;
printf( "not supported\n" );
#endif
}

/*
* Print the input string if the bit is set in the value
Expand Down Expand Up @@ -603,12 +606,7 @@ void print_deserialized_ssl_session( const uint8_t *ssl, uint32_t len,
( (uint64_t) ssl[7] );
ssl += 8;
printf( "\tstart time : " );
#if defined(MBEDTLS_HAVE_TIME)
print_time( (time_t*) &start );
#else
(void) start;
printf( "not supported\n" );
#endif
print_time( &start );
}

CHECK_SSL_END( 2 );
Expand Down

0 comments on commit 3f0c37e

Please sign in to comment.