gtimezone.h 3.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. /*
  2. * Copyright © 2010 Codethink Limited
  3. *
  4. * SPDX-License-Identifier: LGPL-2.1-or-later
  5. *
  6. * This library is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU Lesser General Public
  8. * License as published by the Free Software Foundation; either
  9. * version 2.1 of the License, or (at your option) any later version.
  10. *
  11. * This library is distributed in the hope that it will be useful, but
  12. * WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  14. * Lesser General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU Lesser General Public
  17. * License along with this library; if not, see <http://www.gnu.org/licenses/>.
  18. *
  19. * Author: Ryan Lortie <desrt@desrt.ca>
  20. */
  21. #ifndef __G_TIME_ZONE_H__
  22. #define __G_TIME_ZONE_H__
  23. #if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION)
  24. #error "Only <glib.h> can be included directly."
  25. #endif
  26. #include <glib/gerror.h>
  27. #include <glib/gtypes.h>
  28. G_BEGIN_DECLS
  29. typedef struct _GTimeZone GTimeZone;
  30. /**
  31. * GTimeType:
  32. * @G_TIME_TYPE_STANDARD: the time is in local standard time
  33. * @G_TIME_TYPE_DAYLIGHT: the time is in local daylight time
  34. * @G_TIME_TYPE_UNIVERSAL: the time is in UTC
  35. *
  36. * Disambiguates a given time in two ways.
  37. *
  38. * First, specifies if the given time is in universal or local time.
  39. *
  40. * Second, if the time is in local time, specifies if it is local
  41. * standard time or local daylight time. This is important for the case
  42. * where the same local time occurs twice (during daylight savings time
  43. * transitions, for example).
  44. */
  45. typedef enum
  46. {
  47. G_TIME_TYPE_STANDARD,
  48. G_TIME_TYPE_DAYLIGHT,
  49. G_TIME_TYPE_UNIVERSAL
  50. } GTimeType;
  51. GLIB_DEPRECATED_IN_2_68_FOR (g_time_zone_new_identifier)
  52. GTimeZone * g_time_zone_new (const gchar *identifier);
  53. GLIB_AVAILABLE_IN_2_68
  54. GTimeZone * g_time_zone_new_identifier (const gchar *identifier);
  55. GLIB_AVAILABLE_IN_ALL
  56. GTimeZone * g_time_zone_new_utc (void);
  57. GLIB_AVAILABLE_IN_ALL
  58. GTimeZone * g_time_zone_new_local (void);
  59. GLIB_AVAILABLE_IN_2_58
  60. GTimeZone * g_time_zone_new_offset (gint32 seconds);
  61. GLIB_AVAILABLE_IN_ALL
  62. GTimeZone * g_time_zone_ref (GTimeZone *tz);
  63. GLIB_AVAILABLE_IN_ALL
  64. void g_time_zone_unref (GTimeZone *tz);
  65. GLIB_AVAILABLE_IN_ALL
  66. gint g_time_zone_find_interval (GTimeZone *tz,
  67. GTimeType type,
  68. gint64 time_);
  69. GLIB_AVAILABLE_IN_ALL
  70. gint g_time_zone_adjust_time (GTimeZone *tz,
  71. GTimeType type,
  72. gint64 *time_);
  73. GLIB_AVAILABLE_IN_ALL
  74. const gchar * g_time_zone_get_abbreviation (GTimeZone *tz,
  75. gint interval);
  76. GLIB_AVAILABLE_IN_ALL
  77. gint32 g_time_zone_get_offset (GTimeZone *tz,
  78. gint interval);
  79. GLIB_AVAILABLE_IN_ALL
  80. gboolean g_time_zone_is_dst (GTimeZone *tz,
  81. gint interval);
  82. GLIB_AVAILABLE_IN_2_58
  83. const gchar * g_time_zone_get_identifier (GTimeZone *tz);
  84. G_END_DECLS
  85. #endif /* __G_TIME_ZONE_H__ */