24 namespace foreign_storage {
34 int interval_count = std::stoi(interval.substr(0, interval.length() - 1));
35 auto interval_type = std::tolower(interval[interval.length() - 1]);
37 if (interval_type ==
's') {
38 duration = interval_count;
39 }
else if (interval_type ==
'h') {
40 duration = interval_count * 60 * 60;
41 }
else if (interval_type ==
'd') {
42 duration = interval_count * 60 * 60 * 24;
52 const std::map<std::string, std::string, std::less<>>& foreign_table_options) {
54 auto start_date_entry = foreign_table_options.find(
56 CHECK(start_date_entry != foreign_table_options.end());
57 auto start_date_time = dateTimeParse<kTIMESTAMP>(start_date_entry->second, 0);
60 if (start_date_time >= current_time) {
61 return start_date_time;
65 if (interval_entry != foreign_table_options.end()) {
68 (current_time - start_date_time + interval_duration - 1) / interval_duration;
69 return start_date_time + (num_intervals * interval_duration);
81 return std::chrono::duration_cast<std::chrono::seconds>(
82 std::chrono::system_clock::now().time_since_epoch())
static std::atomic< int64_t > mock_current_time_
static constexpr const char * REFRESH_START_DATE_TIME_KEY
static int64_t getNextRefreshTime(const std::map< std::string, std::string, std::less<>> &foreign_table_options)
static constexpr const char * REFRESH_INTERVAL_KEY
int64_t get_interval_duration(const std::string &interval)
static constexpr int NULL_REFRESH_TIME
static int64_t getCurrentTime()
static void setMockCurrentTime(int64_t mock_current_time)
static void resetMockCurrentTime()
static std::atomic< bool > should_use_mock_current_time_