jtime.ipp 3.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. /*##############################################################################
  2. HPCC SYSTEMS software Copyright (C) 2012 HPCC Systems.
  3. Licensed under the Apache License, Version 2.0 (the "License");
  4. you may not use this file except in compliance with the License.
  5. You may obtain a copy of the License at
  6. http://www.apache.org/licenses/LICENSE-2.0
  7. Unless required by applicable law or agreed to in writing, software
  8. distributed under the License is distributed on an "AS IS" BASIS,
  9. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  10. See the License for the specific language governing permissions and
  11. limitations under the License.
  12. ############################################################################## */
  13. #ifndef JTIME_IPP
  14. #define JTIME_IPP
  15. #include "jtime.hpp"
  16. class jlib_decl CScmDateTime : public CInterface, implements IJlibDateTime
  17. {
  18. public:
  19. CScmDateTime();
  20. IMPLEMENT_IINTERFACE
  21. virtual IStringVal & getString(IStringVal & str) const;
  22. virtual IStringVal & getDateString(IStringVal & str) const;
  23. virtual IStringVal & getTimeString(IStringVal & str) const;
  24. virtual void getDate(unsigned & _year, unsigned & _month, unsigned & _day) const;
  25. virtual void getTime(unsigned & _hour, unsigned & _min, unsigned & _sec, unsigned & _nanosec, int & localToGmtDelta) const;
  26. virtual IStringVal & getGmtString(IStringVal & str) const;
  27. virtual IStringVal & getGmtDateString(IStringVal & str) const;
  28. virtual IStringVal & getGmtTimeString(IStringVal & str) const;
  29. virtual void getGmtDate(unsigned & _year, unsigned & _month, unsigned & _day) const;
  30. virtual void getGmtTime(unsigned & _hour, unsigned & _min, unsigned & _sec, unsigned & _nanosec) const;
  31. virtual IStringVal & getLocalString(IStringVal & str) const;
  32. virtual IStringVal & getLocalDateString(IStringVal & str) const;
  33. virtual IStringVal & getLocalTimeString(IStringVal & str) const;
  34. virtual void getLocalDate(unsigned & _year, unsigned & _month, unsigned & _day) const;
  35. virtual void getLocalTime(unsigned & _hour, unsigned & _min, unsigned & _sec, unsigned & _nanosec) const;
  36. virtual int compare(const IJlibConstDateTime & other) const;
  37. //Modification
  38. virtual void setString(const char * pstr);
  39. virtual void setDateTime(unsigned _year, unsigned _month, unsigned _day, unsigned _hour, unsigned _min, unsigned _sec, unsigned _nanosec, int localToGmtDelta);
  40. virtual void setGmtString(const char * pstr);
  41. virtual void setGmtDateString(const char * pstr);
  42. virtual void setGmtTimeString(const char * pstr);
  43. virtual void setGmtDate(unsigned _year, unsigned _month, unsigned _day);
  44. virtual void setGmtTime(unsigned _hour, unsigned _min, unsigned _sec, unsigned _nanosec);
  45. virtual void setLocalString(const char * pstr);
  46. virtual void setLocalDateString(const char * pstr);
  47. virtual void setLocalTimeString(const char * pstr);
  48. virtual void setLocalDate(unsigned _year, unsigned _month, unsigned _day);
  49. virtual void setLocalTime(unsigned _hour, unsigned _min, unsigned _sec, unsigned _nanosec);
  50. void setNow();
  51. void setSimpleGmt(time_t simple);
  52. void setSimpleLocal(time_t simple); // time_t has no zone, so these differ only in value of utcToLocalDelta stored
  53. protected:
  54. CDateTime cdt;
  55. int utcToLocalDelta; // delta gmt->local of timezone, for set/get which don't specify gmt or local
  56. };
  57. #endif