From fbbb2d0b2aba4ddc42651096b20dd4a7ca4a33f2 Mon Sep 17 00:00:00 2001 From: Guo Wenxue <guowenxue@gmail.com> Date: Wed, 21 Sep 2022 23:04:57 +0800 Subject: [PATCH] Merge branch 'master' of ssh://master.iot-yun.club:2280/raspberrypi --- 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