Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

windows crash with orbcat a,r times, fix relative time. #117

Merged
merged 1 commit into from
Aug 22, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions Src/orbcat.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include <inttypes.h>
#include <getopt.h>
#include <time.h>
#include <sys/time.h>

#include "nw.h"
#include "git_version_info.h"
Expand All @@ -35,7 +36,7 @@
#define ONE_SEC_IN_USEC (1000000) /* Used for time conversions...usec in one sec */

/* Formats for timestamping */
#define REL_FORMAT "%6" PRIu64 ".%01" PRIu64 "|"
#define REL_FORMAT "%6" PRIu64 ".%03" PRIu64 "|"
#define REL_FORMAT_INIT " Initial|"
#define DEL_FORMAT "%3" PRIu64 ".%03" PRIu64 "|"
#define DEL_FORMAT_CTD " +|"
Expand Down Expand Up @@ -99,7 +100,7 @@ struct
} _r;

// ====================================================================================================
int64_t _timestamp( void )
uint64_t _timestamp( void )

{
struct timeval te;
Expand Down Expand Up @@ -137,7 +138,8 @@ static void _outputTimestamp( void )
}
else
{
res = _r.oldte - _timestamp();
uint64_t now = _timestamp();
res = now - _r.oldte;
fprintf( stdout, REL_FORMAT, res / ONE_SEC_IN_USEC, ( res / ( ONE_SEC_IN_USEC / 1000 ) ) % 1000 );
}

Expand Down