MCPcopy Create free account
hub / github.com/Snapchat/KeyDB / rdbLoadMillisecondTime

Function rdbLoadMillisecondTime

src/rdb.cpp:153–159  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

151 * valid stored value, the caller should use rioGetReadError() to check for
152 * errors after calling this function. */
153long 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

Callers 3

rdbLoadObjectFunction · 0.85
rdbLoadRioFunction · 0.85
redis_check_rdbFunction · 0.85

Calls 1

rioReadFunction · 0.85

Tested by

no test coverage detected