| 121 | } |
| 122 | |
| 123 | void duration_example1() |
| 124 | { |
| 125 | std::vector<uint8_t> data = { |
| 126 | 0xd6, // fixext 4 stores an integer and a byte array whose length is 4 bytes |
| 127 | 0xff, // timestamp |
| 128 | 0x5a,0x4a,0xf6,0xa5 // 1514862245 |
| 129 | }; |
| 130 | auto seconds = msgpack::decode_msgpack<std::chrono::seconds>(data); |
| 131 | std::cout << "Seconds elapsed since 1970-01-01 00:00:00 UTC: " << seconds.count() << "\n"; |
| 132 | } |
| 133 | |
| 134 | void duration_example2() |
| 135 | { |