OmniSciDB  72c90bc290
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DayTimeInterval Struct Reference

#include <heavydbTypes.h>

Public Member Functions

DEVICE DayTimeInterval (int64_t init)
 
DEVICE ALWAYS_INLINE bool operator== (const DayTimeInterval &other) const
 
DEVICE ALWAYS_INLINE bool operator!= (const DayTimeInterval &other) const
 
DEVICE ALWAYS_INLINE Timestamp operator+ (const Timestamp &t) const
 
DEVICE ALWAYS_INLINE
DayTimeInterval 
operator* (const int64_t multiplier) const
 
DEVICE ALWAYS_INLINE int64_t numStepsBetween (const Timestamp &begin, const Timestamp &end) const
 

Public Attributes

int64_t timeval
 

Detailed Description

Definition at line 853 of file heavydbTypes.h.

Constructor & Destructor Documentation

DEVICE DayTimeInterval::DayTimeInterval ( int64_t  init)
inline

Definition at line 856 of file heavydbTypes.h.

Referenced by operator*().

856 : timeval(init) {}
void init(LogOptions const &log_opts)
Definition: Logger.cpp:364

+ Here is the caller graph for this function:

Member Function Documentation

DEVICE ALWAYS_INLINE int64_t DayTimeInterval::numStepsBetween ( const Timestamp begin,
const Timestamp end 
) const
inline

Definition at line 875 of file heavydbTypes.h.

References kMicroSecsPerSec, Timestamp::time, and timeval.

876  {
877 #ifndef __CUDACC__
878  if (timeval == 0) {
879  throw std::runtime_error("Timestamp division by zero!");
880  }
881 #endif
882 
883  if ((timeval > 0 && end.time < begin.time) ||
884  (timeval < 0 && end.time > begin.time)) {
885  return -1;
886  }
887 
888  Timestamp diff = end.time - begin.time;
889  int64_t asNanoSecs =
890  static_cast<int64_t>(timeval) * static_cast<int64_t>(kMicroSecsPerSec);
891 #ifndef __CUDACC__
892  if (timeval != 0 && asNanoSecs / timeval != static_cast<int64_t>(kMicroSecsPerSec)) {
893  throw std::overflow_error("Overflow in INTERVAL precision conversion!");
894  }
895 #endif
896 
897  return diff / asNanoSecs;
898  }
int64_t time
Definition: heavydbTypes.h:699
static constexpr int64_t kMicroSecsPerSec
DEVICE ALWAYS_INLINE bool DayTimeInterval::operator!= ( const DayTimeInterval other) const
inline

Definition at line 862 of file heavydbTypes.h.

References operator==().

862  {
863  return !operator==(other);
864  }
DEVICE ALWAYS_INLINE bool operator==(const DayTimeInterval &other) const
Definition: heavydbTypes.h:858

+ Here is the call graph for this function:

DEVICE ALWAYS_INLINE DayTimeInterval DayTimeInterval::operator* ( const int64_t  multiplier) const
inline

Definition at line 871 of file heavydbTypes.h.

References DayTimeInterval(), and timeval.

871  {
872  return DayTimeInterval(timeval * multiplier);
873  }
DEVICE DayTimeInterval(int64_t init)
Definition: heavydbTypes.h:856

+ Here is the call graph for this function:

DEVICE ALWAYS_INLINE Timestamp DayTimeInterval::operator+ ( const Timestamp t) const
inline

Definition at line 866 of file heavydbTypes.h.

References daMILLISECOND, DateAddHighPrecisionNullable(), Timestamp::time, Timestamp, and timeval.

866  {
868  daMILLISECOND, timeval, t.time, 9, inline_int_null_value<int64_t>()));
869  }
int64_t time
Definition: heavydbTypes.h:699
RUNTIME_EXPORT DEVICE int64_t DateAddHighPrecisionNullable(const DateaddField field, const int64_t number, const int64_t timeval, const int32_t dim, const int64_t null_val)

+ Here is the call graph for this function:

DEVICE ALWAYS_INLINE bool DayTimeInterval::operator== ( const DayTimeInterval other) const
inline

Definition at line 858 of file heavydbTypes.h.

References timeval.

Referenced by operator!=().

858  {
859  return timeval == other.timeval;
860  }

+ Here is the caller graph for this function:

Member Data Documentation

int64_t DayTimeInterval::timeval

Definition at line 854 of file heavydbTypes.h.

Referenced by numStepsBetween(), operator*(), operator+(), and operator==().


The documentation for this struct was generated from the following file: