wmc: fix init command

Actually read what struct tm contains and use it correctly,
and fix the init command struct size.
This commit is contained in:
Dan Williams
2012-01-23 10:23:37 -06:00
parent 66b7ef018e
commit f90fe19068
2 changed files with 3 additions and 3 deletions

View File

@@ -84,8 +84,8 @@ wmc_cmd_init_new (char *buf, size_t buflen, int wmc2)
memset (cmd, 0, sizeof (*cmd)); memset (cmd, 0, sizeof (*cmd));
cmd->hdr.marker = WMC_CMD_MARKER; cmd->hdr.marker = WMC_CMD_MARKER;
cmd->hdr.cmd = WMC_CMD_INIT; cmd->hdr.cmd = WMC_CMD_INIT;
cmd->year = htole16 (tm->tm_year); cmd->year = htole16 (tm->tm_year + 1900);
cmd->month = tm->tm_mon; cmd->month = tm->tm_mon + 1;
cmd->day = htobe16 (tm->tm_mday); cmd->day = htobe16 (tm->tm_mday);
cmd->hours = htobe16 (tm->tm_hour); cmd->hours = htobe16 (tm->tm_hour);
cmd->minutes = htobe16 (tm->tm_min); cmd->minutes = htobe16 (tm->tm_min);

View File

@@ -64,7 +64,7 @@ struct WmcCmdInit2 {
u_int16_t hours; /* big endian */ u_int16_t hours; /* big endian */
u_int16_t minutes; /* big endian */ u_int16_t minutes; /* big endian */
u_int16_t seconds; /* big endian */ u_int16_t seconds; /* big endian */
u_int8_t _unknown1[2]; u_int8_t _unknown1[3];
} __attribute__ ((packed)); } __attribute__ ((packed));
typedef struct WmcCmdInit2 WmcCmdInit2; typedef struct WmcCmdInit2 WmcCmdInit2;