This function loads a time from the RDB file. It gets the version of the * RDB because, unfortunately, before Redis 5 (RDB version 9), the function * failed to convert data to/from little endian, so RDB files with keys having * expires could not be shared between big endian and little endian systems * (because the expire time will be totally wrong). The fix for this is just * to call memrev64
| 151 | * valid stored value, the caller should use rioGetReadError() to check for |
| 152 | * errors after calling this function. */ |
| 153 | long long rdbLoadMillisecondTime(rio *rdb, int rdbver) { |
| 154 | int64_t t64; |
| 155 | if (rioRead(rdb,&t64,8) == 0) return LLONG_MAX; |
| 156 | if (rdbver >= 9) /* Check the top comment of this function. */ |
| 157 | memrev64ifbe(&t64); /* Convert in big endian if the system is BE. */ |
| 158 | return (long long)t64; |
| 159 | } |
| 160 | |
| 161 | /* Saves an encoded length. The first two bits in the first byte are used to |
| 162 | * hold the encoding type. See the RDB_* definitions for more information |
no test coverage detected