aboutsummaryrefslogtreecommitdiff
path: root/libwmc/src
diff options
context:
space:
mode:
authorDan Williams <dcbw@redhat.com>2012-01-23 10:23:37 -0600
committerDan Williams <dcbw@redhat.com>2012-01-23 10:48:28 -0600
commitf90fe1906856fd708f2f62f49486f94bfacf255f (patch)
treeb845d1a612ebc97d54358bbeb94b7e08b261a28f /libwmc/src
parent66b7ef018e983fb5f77624e2d119ded7cc24b6be (diff)
wmc: fix init command
Actually read what struct tm contains and use it correctly, and fix the init command struct size.
Diffstat (limited to 'libwmc/src')
-rw-r--r--libwmc/src/commands.c4
-rw-r--r--libwmc/src/protocol.h2
2 files changed, 3 insertions, 3 deletions
diff --git a/libwmc/src/commands.c b/libwmc/src/commands.c
index 45976f19..e617eabf 100644
--- a/libwmc/src/commands.c
+++ b/libwmc/src/commands.c
@@ -84,8 +84,8 @@ wmc_cmd_init_new (char *buf, size_t buflen, int wmc2)
memset (cmd, 0, sizeof (*cmd));
cmd->hdr.marker = WMC_CMD_MARKER;
cmd->hdr.cmd = WMC_CMD_INIT;
- cmd->year = htole16 (tm->tm_year);
- cmd->month = tm->tm_mon;
+ cmd->year = htole16 (tm->tm_year + 1900);
+ cmd->month = tm->tm_mon + 1;
cmd->day = htobe16 (tm->tm_mday);
cmd->hours = htobe16 (tm->tm_hour);
cmd->minutes = htobe16 (tm->tm_min);
diff --git a/libwmc/src/protocol.h b/libwmc/src/protocol.h
index 1e7df0d8..ef0314cc 100644
--- a/libwmc/src/protocol.h
+++ b/libwmc/src/protocol.h
@@ -64,7 +64,7 @@ struct WmcCmdInit2 {
u_int16_t hours; /* big endian */
u_int16_t minutes; /* big endian */
u_int16_t seconds; /* big endian */
- u_int8_t _unknown1[2];
+ u_int8_t _unknown1[3];
} __attribute__ ((packed));
typedef struct WmcCmdInit2 WmcCmdInit2;