MCPcopy Create free account
hub / github.com/F-Stack/f-stack / rdbLoadMillisecondTime

Function rdbLoadMillisecondTime

app/redis-6.2.6/src/rdb.c:148–154  ·  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

146 * valid stored value, the caller should use rioGetReadError() to check for
147 * errors after calling this function. */
148long long rdbLoadMillisecondTime(rio *rdb, int rdbver) {
149 int64_t t64;
150 if (rioRead(rdb,&t64,8) == 0) return LLONG_MAX;
151 if (rdbver >= 9) /* Check the top comment of this function. */
152 memrev64ifbe(&t64); /* Convert in big endian if the system is BE. */
153 return (long long)t64;
154}
155
156/* Saves an encoded length. The first two bits in the first byte are used to
157 * 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