Rev 513 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 513 | Rev 524 | ||
---|---|---|---|
Line 14... | Line 14... | ||
14 | 14 | ||
15 | void print_data(char * data, std::string type, char * color) { |
15 | void print_data(char * data, std::string type, char * color) { |
16 | char buffer [20]; |
16 | char buffer [20]; |
17 | timeval timestamp; |
17 | timeval timestamp; |
18 | gettimeofday(×tamp, 0); |
18 | gettimeofday(×tamp, 0); |
19 | sprintf(buffer, "%i.%03i", timestamp.tv_sec, (timestamp.tv_usec+500)/1000); |
19 | sprintf(buffer, "%i.%07i", timestamp.tv_sec, timestamp.tv_usec); |
20 | //alternative to show human readable output |
20 | //alternative to show human readable output |
21 | /* |
21 | /* |
22 | time_t rawtime; |
22 | time_t rawtime; |
23 | struct tm * timeinfo; |
23 | struct tm * timeinfo; |
Line 38... | Line 38... | ||
38 | printf("raw data:"); |
38 | printf("raw data:"); |
39 | for( int i = 0 ; i < length; i++ ){ |
39 | for( int i = 0 ; i < length; i++ ){ |
40 | printf("%c", data[i]); |
40 | printf("%c", data[i]); |
41 | } |
41 | } |
42 | printf(" hex:"); |
42 | printf(" hex:"); |
43 | for( int i = 0 ; i < length ; i++ ){ |
43 | for( int i = 0 ; i < length ; i++ ){ |
44 | printf( "%02hhx " , data[i] ); |
44 | printf( "%02hhx " , data[i] ); |
45 | } |
45 | } |
46 | printf( "\n" ); |
46 | printf( "\n" ); |
47 | } |
47 | } |
Line 48... | Line 48... | ||
48 | 48 |