协议是:
(four byte hour/minute/second field, for example (12:13:56 110))
bit00~bit01: 00
bit02~bit11: millisecond (110)
bit12~bit15: second-1s (6)
bit16~bit18: second-10s (5)
bit19~bit22: minute-1s (3)
bit23~bit25: minute-10s (1)
bit26~bit29: hour-1s (2)
bit30~bit31: hour-10s (1)
我应该如何定义上层结构?
我试图定义这个:
struct xxx_time
{
unsigned int pad:2;
unsigned int second0:4;
unsigned int second1:3;
unsigned int minute0:4;
unsigned int minute1:3;
unsigned int hour:4;
unsigned int hour1:2;
};
以这种方式定义它是否正确?有没有更好的办法?