PLplot: wxPLplot_nanosec.cpp Source File

PLplot 5.15.0

wxPLplot_nanosec.cpp
Go to the documentation of this file.
1 #include "wxPLplot_nanosec.h"
2 #if defined ( PLPLOT_WX_DEBUG_OUTPUT ) && defined ( PLPLOT_WX_NANOSEC )
3
4 #include <stdint.h> // for uint64 definition
5 #include <time.h> // for clock_gettime
6 #define BILLION 1000000000L
7
8 void
9 pl_wx_nanosec( const char *string )
10 {
11 uint64_t timestamp;
12 struct timespec timenano;
13 // Determine seconds since the epoch and nanosecs since the epoch of
14 // the last second.
15 clock_gettime( CLOCK_MONOTONIC, &timenano );
16 timestamp = BILLION * ( timenano.tv_sec ) + timenano.tv_nsec;
17 wxLogDebug( "nanosecs since epoch = %llu: %s", (long long unsigned int) timestamp, string );
18 }
19 #endif //#if defined(PLPLOT_WX_DEBUG_OUTPUT) && defined(PLPLOT_WX_NANOSEC)
wxPLplot_nanosec.h