From 665e1b5cb16d058f478867d0e8a4f8632e2cb02e Mon Sep 17 00:00:00 2001
From: GuoWenxue <“guowenxue@gmail.com”>
Date: Fri, 29 Apr 2022 10:29:19 +0800
Subject: [PATCH] upate packet time to struct tm
---
apue/project_socket/src/packet.h | 14 +++++++-------
1 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/apue/project_socket/src/packet.h b/apue/project_socket/src/packet.h
index e70147d..d1b176e 100644
--- a/apue/project_socket/src/packet.h
+++ b/apue/project_socket/src/packet.h
@@ -16,15 +16,16 @@
#define _PACKET_H_
#include <stdint.h>
+#include <time.h>
#define DEVID_LEN 16
#define TIME_LEN 32
typedef struct pack_info_s
{
- char devid[DEVID_LEN]; /* device ID */
- char strtime[TIME_LEN]; /* sample time */
- uint16_t temper; /* sample temperature */
+ char devid[DEVID_LEN]; /* device ID */
+ struct tm sample_time; /* sample time */
+ uint16_t temper; /* sample temperature */
} pack_info_t;
/* packet function pointer type */
@@ -39,13 +40,12 @@
*/
extern int get_devid(char *devid, int size, int sn);
-/* description: get current system in format "YYYY-MM-DD HH:MM:SS"
+/* description: get current system in struct tm
* input args:
- * $strtime: time string output buf
- * $size : time string output buffer size
+ * $sample_time: sample time in struct tm
* return value: <0: failure 0:ok
*/
-extern int get_time(char *strtime, int size);
+extern int get_time(struct tm *sample_time);
/* description: package a string packet in format "devid|time|temper"
* input args:
--
Gitblit v1.9.1