File tree Expand file tree Collapse file tree 2 files changed +10
-10
lines changed Expand file tree Collapse file tree 2 files changed +10
-10
lines changed Original file line number Diff line number Diff line change @@ -61,21 +61,21 @@ Status UtilityDB::OpenTtlDB(
61
61
}
62
62
63
63
// Gives back the current time
64
- Status DBWithTTL::GetCurrentTime (int32_t & curtime) {
65
- return Env::Default ()->GetCurrentTime (( int64_t *) &curtime);
64
+ Status DBWithTTL::GetCurrentTime (int64_t & curtime) {
65
+ return Env::Default ()->GetCurrentTime (&curtime);
66
66
}
67
67
68
68
// Appends the current timestamp to the string.
69
69
// Returns false if could not get the current_time, true if append succeeds
70
70
Status DBWithTTL::AppendTS (const Slice& val, std::string& val_with_ts) {
71
71
val_with_ts.reserve (kTSLength + val.size ());
72
72
char ts_string[kTSLength ];
73
- int32_t curtime;
73
+ int64_t curtime;
74
74
Status st = GetCurrentTime (curtime);
75
75
if (!st.ok ()) {
76
76
return st;
77
77
}
78
- EncodeFixed32 (ts_string, curtime);
78
+ EncodeFixed32 (ts_string, ( int32_t ) curtime);
79
79
val_with_ts.append (val.data (), val.size ());
80
80
val_with_ts.append (ts_string, kTSLength );
81
81
return st;
@@ -102,7 +102,7 @@ bool DBWithTTL::IsStale(const Slice& value, int32_t ttl) {
102
102
if (ttl <= 0 ) { // Data is fresh if TTL is non-positive
103
103
return false ;
104
104
}
105
- int32_t curtime;
105
+ int64_t curtime;
106
106
if (!GetCurrentTime (curtime).ok ()) {
107
107
return false ; // Treat the data as fresh if could not get current time
108
108
}
Original file line number Diff line number Diff line change @@ -100,7 +100,7 @@ class DBWithTTL : public StackableDB {
100
100
101
101
static Status StripTS (std::string* str);
102
102
103
- static Status GetCurrentTime (int32_t & curtime);
103
+ static Status GetCurrentTime (int64_t & curtime);
104
104
105
105
static const uint32_t kTSLength = sizeof (int32_t ); // size of timestamp
106
106
@@ -302,14 +302,14 @@ class TtlMergeOperator : public MergeOperator {
302
302
}
303
303
304
304
// Augment the *new_value with the ttl time-stamp
305
- int32_t curtime;
305
+ int64_t curtime;
306
306
if (!DBWithTTL::GetCurrentTime (curtime).ok ()) {
307
307
Log (logger, " Error: Could not get current time to be attached internally "
308
308
" to the new value." );
309
309
return false ;
310
310
} else {
311
311
char ts_string[ts_len];
312
- EncodeFixed32 (ts_string, curtime);
312
+ EncodeFixed32 (ts_string, ( int32_t ) curtime);
313
313
new_value->append (ts_string, ts_len);
314
314
return true ;
315
315
}
@@ -337,14 +337,14 @@ class TtlMergeOperator : public MergeOperator {
337
337
}
338
338
339
339
// Augment the *new_value with the ttl time-stamp
340
- int32_t curtime;
340
+ int64_t curtime;
341
341
if (!DBWithTTL::GetCurrentTime (curtime).ok ()) {
342
342
Log (logger, " Error: Could not get current time to be attached internally "
343
343
" to the new value." );
344
344
return false ;
345
345
} else {
346
346
char ts_string[ts_len];
347
- EncodeFixed32 (ts_string, curtime);
347
+ EncodeFixed32 (ts_string, ( int32_t ) curtime);
348
348
new_value->append (ts_string, ts_len);
349
349
return true ;
350
350
}
You can’t perform that action at this time.
0 commit comments