Timezone.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. //
  2. // Timezone.h
  3. //
  4. // $Id: //poco/1.4/Foundation/include/Poco/Timezone.h#1 $
  5. //
  6. // Library: Foundation
  7. // Package: DateTime
  8. // Module: Timezone
  9. //
  10. // Definition of the Timezone class.
  11. //
  12. // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
  13. // and Contributors.
  14. //
  15. // SPDX-License-Identifier: BSL-1.0
  16. //
  17. #ifndef Foundation_Timezone_INCLUDED
  18. #define Foundation_Timezone_INCLUDED
  19. #include "Poco/Foundation.h"
  20. #include "Poco/Timestamp.h"
  21. namespace Poco {
  22. class Foundation_API Timezone
  23. /// This class provides information about the current timezone.
  24. {
  25. public:
  26. static int utcOffset();
  27. /// Returns the offset of local time to UTC, in seconds.
  28. /// local time = UTC + utcOffset() + dst().
  29. static int dst();
  30. /// Returns the daylight saving time offset in seconds if
  31. /// daylight saving time is in use.
  32. /// local time = UTC + utcOffset() + dst().
  33. static bool isDst(const Timestamp& timestamp);
  34. /// Returns true if daylight saving time is in effect
  35. /// for the given time. Depending on the operating system
  36. /// platform this might only work reliably for certain
  37. /// date ranges, as the C library's localtime() function
  38. /// is used.
  39. static int tzd();
  40. /// Returns the time zone differential for the current timezone.
  41. /// The timezone differential is computed as utcOffset() + dst()
  42. /// and is expressed in seconds.
  43. static std::string name();
  44. /// Returns the timezone name currently in effect.
  45. static std::string standardName();
  46. /// Returns the timezone name if not daylight saving time is in effect.
  47. static std::string dstName();
  48. /// Returns the timezone name if daylight saving time is in effect.
  49. };
  50. } // namespace Poco
  51. #endif // Foundation_Timezone_INCLUDED