projects
/
hmcfgusb
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
8292227
)
add timestamp
author
Michael Gernoth
<michael@gernoth.net>
Thu, 30 May 2013 22:31:51 +0000
(
00:31
+0200)
committer
Michael Gernoth
<michael@gernoth.net>
Thu, 30 May 2013 22:31:51 +0000
(
00:31
+0200)
hmsniff.c
patch
|
blob
|
blame
|
history
diff --git
a/hmsniff.c
b/hmsniff.c
index 7cc20c115a8a545449c18fd3d7fa3de7edad5465..9ce1fce3aca70ecd68277e5e886cec033b36f786 100644
(file)
--- a/
hmsniff.c
+++ b/
hmsniff.c
@@
-29,10
+29,7
@@
#include <strings.h>
#include <poll.h>
#include <errno.h>
#include <strings.h>
#include <poll.h>
#include <errno.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
+#include <sys/time.h>
#include <libusb-1.0/libusb.h>
#include "hexdump.h"
#include <libusb-1.0/libusb.h>
#include "hexdump.h"
@@
-95,8
+92,17
@@
char *hm_message_types(uint8_t type)
static void dissect_hm(uint8_t *buf, int len)
{
static void dissect_hm(uint8_t *buf, int len)
{
+ struct timeval tv;
+ struct tm *tmp;
+ char ts[32];
int i;
int i;
+ gettimeofday(&tv, NULL);
+ tmp = localtime(&tv.tv_sec);
+ memset(ts, 0, sizeof(ts));
+ strftime(ts, sizeof(ts)-1, "%Y-%m-%d %H:%M:%S", tmp);
+ printf("%s.%06ld: ", ts, tv.tv_usec);
+
for (i = 0; i < len; i++) {
printf("%02X", buf[i]);
}
for (i = 0; i < len; i++) {
printf("%02X", buf[i]);
}
Impressum
,
Datenschutz