base.pxd 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. from libc.stdint cimport uint32_t
  2. from libc.stdint cimport uint64_t
  3. from libcpp cimport bool as bool_t
  4. from posix.types cimport time_t
  5. from util.generic.string cimport TString, TStringBuf
  6. cdef extern from "<util/datetime/base.h>" nogil:
  7. cdef cppclass TTimeBase:
  8. TTimeBase()
  9. TTimeBase(uint64_t)
  10. uint64_t GetValue()
  11. double SecondsFloat()
  12. uint64_t MicroSeconds()
  13. uint64_t MilliSeconds()
  14. uint64_t Seconds()
  15. uint64_t Minutes()
  16. uint64_t Hours()
  17. uint64_t Days()
  18. uint64_t NanoSeconds()
  19. uint32_t MicroSecondsOfSecond()
  20. uint32_t MilliSecondsOfSecond()
  21. uint32_t NanoSecondsOfSecond()
  22. cdef cppclass TInstant(TTimeBase):
  23. TInstant()
  24. TInstant(uint64_t)
  25. @staticmethod
  26. TInstant Now() except +
  27. @staticmethod
  28. TInstant Max()
  29. @staticmethod
  30. TInstant Zero()
  31. @staticmethod
  32. TInstant MicroSeconds(uint64_t)
  33. @staticmethod
  34. TInstant MilliSeconds(uint64_t)
  35. @staticmethod
  36. TInstant Seconds(uint64_t)
  37. @staticmethod
  38. TInstant Minutes(uint64_t)
  39. @staticmethod
  40. TInstant Hours(uint64_t)
  41. @staticmethod
  42. TInstant Days(uint64_t)
  43. time_t TimeT()
  44. TString ToString() except +
  45. TString ToStringUpToSeconds() except +
  46. TString ToStringLocal() except +
  47. TString ToStringLocalUpToSeconds() except +
  48. TString FormatLocalTime(const char*)
  49. TString FormatGmTime(const char* format)
  50. @staticmethod
  51. TInstant ParseIso8601(const TStringBuf) except +
  52. @staticmethod
  53. TInstant ParseRfc822(const TStringBuf) except +
  54. @staticmethod
  55. TInstant ParseHttp(const TStringBuf) except +
  56. @staticmethod
  57. TInstant ParseX509Validity(const TStringBuf) except +
  58. @staticmethod
  59. bool_t TryParseIso8601(const TStringBuf, TInstant&) except +
  60. @staticmethod
  61. bool_t TryParseRfc822(const TStringBuf, TInstant&) except +
  62. @staticmethod
  63. bool_t TryParseHttp(const TStringBuf, TInstant&) except +
  64. @staticmethod
  65. bool_t TryParseX509(const TStringBuf, TInstant&) except +
  66. @staticmethod
  67. TInstant ParseIso8601Deprecated(const TStringBuf) except +
  68. @staticmethod
  69. TInstant ParseRfc822Deprecated(const TStringBuf) except +
  70. @staticmethod
  71. TInstant ParseHttpDeprecated(const TStringBuf) except +
  72. @staticmethod
  73. TInstant ParseX509ValidityDeprecated(const TStringBuf) except +
  74. @staticmethod
  75. bool_t TryParseIso8601Deprecated(const TStringBuf, TInstant&) except +
  76. @staticmethod
  77. bool_t TryParseRfc822Deprecated(const TStringBuf, TInstant&) except +
  78. @staticmethod
  79. bool_t TryParseHttpDeprecated(const TStringBuf, TInstant&) except +
  80. @staticmethod
  81. bool_t TryParseX509Deprecated(const TStringBuf, TInstant&) except +
  82. cdef cppclass TDuration(TTimeBase):
  83. TDuration()
  84. TDuration(uint64_t)
  85. @staticmethod
  86. TDuration MicroSeconds(uint64_t)
  87. TInstant ToDeadLine() except +
  88. TInstant ToDeadLine(TInstant) except +
  89. @staticmethod
  90. TDuration Max()
  91. @staticmethod
  92. TDuration Zero()
  93. @staticmethod
  94. TDuration Seconds(uint64_t)
  95. @staticmethod
  96. TDuration Minutes(uint64_t)
  97. @staticmethod
  98. TDuration Hours(uint64_t)
  99. @staticmethod
  100. TDuration Days(uint64_t)
  101. @staticmethod
  102. TDuration Parse(const TStringBuf)
  103. @staticmethod
  104. bool_t TryParse(const TStringBuf, TDuration&)
  105. TString ToString() except +