// Generated by gmmproc 2.84.0 -- DO NOT MODIFY! #ifndef _GLIBMM_DATETIME_H #define _GLIBMM_DATETIME_H /* Copyright (C) 2011 The glibmm Development Team * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library. If not, see . */ #include #include #include #include #include #ifndef DOXYGEN_SHOULD_SKIP_THIS typedef struct _GDateTime GDateTime; #endif #ifndef DOXYGEN_SHOULD_SKIP_THIS extern "C" { typedef struct _GDateTime GDateTime; } #endif namespace Glib { /** A value representing an interval of time, in microseconds. As GTimeSpan, * its underlying type is gint64. */ using TimeSpan = GTimeSpan; /** DateTime - A structure representing Date and Time. * DateTime is a structure that combines a Gregorian date and time into a * single structure. It provides many conversion and methods to manipulate * dates and times. Time precision is provided down to microseconds and the * time can range (proleptically) from 0001-01-01 00:00:00 to 9999-12-31 * 23:59:59.999999. DateTime follows POSIX time in the sense that it is * oblivious to leap seconds. * * DateTime is an immutable object; once it has been created it cannot be * modified further. All modifiers will create a new DateTime. Nearly all such * functions can fail due to the date or time going out of range, in which case * 0 will be returned. * * Many parts of the API may produce non-obvious results. As an example, adding * two months to January 31st will yield March 31st whereas adding one month * and then one month again will yield either March 28th or March 29th. Also * note that adding 24 hours is not always the same as adding one day (since * days containing daylight savings time transitions are either 23 or 25 hours * in length). * @newin{2,30} */ class GLIBMM_API DateTime { // GDateTime is refcounted, but Glib::DateTime is not. // GDateTime is immutable. Therefore, there is no problem having several // Glib::DateTime instances wrap the same GDateTime, and it's easier to use // Glib::DateTime without Glib::RefPtr. public: #ifndef DOXYGEN_SHOULD_SKIP_THIS using CppObjectType = DateTime; using BaseObjectType = GDateTime; #endif /* DOXYGEN_SHOULD_SKIP_THIS */ /** Get the GType for this class, for use with the underlying GObject type system. */ static GType get_type() G_GNUC_CONST; DateTime(); explicit DateTime(GDateTime* gobject, bool make_a_copy = true); DateTime(const DateTime& other); DateTime& operator=(const DateTime& other); DateTime(DateTime&& other) noexcept; DateTime& operator=(DateTime&& other) noexcept; ~DateTime() noexcept; void swap(DateTime& other) noexcept; ///Provides access to the underlying C instance. GDateTime* gobj() { return gobject_; } ///Provides access to the underlying C instance. const GDateTime* gobj() const { return gobject_; } ///Provides access to the underlying C instance. The caller is responsible for freeing it. Use when directly setting fields in structs. GDateTime* gobj_copy() const; protected: GDateTime* gobject_; private: public: /** Creates a DateTime corresponding to this exact instant in the given * time zone @a tz. The time is as accurate as the system allows, to a * maximum accuracy of 1 microsecond. * * This function will always succeed unless GLib is still being used after the * year 9999. * * You should release the return value by calling g_date_time_unref() * when you are done with it. * * @newin{2,26} * * @param tz A TimeZone. * @return A new DateTime, or nullptr. */ static DateTime create_now(const TimeZone& tz); /** Creates a DateTime corresponding to this exact instant in the local * time zone. * * This is equivalent to calling g_date_time_new_now() with the time * zone returned by g_time_zone_new_local(). * * @newin{2,26} * * @return A new DateTime, or nullptr. */ static DateTime create_now_local(); /** Creates a DateTime corresponding to this exact instant in UTC. * * This is equivalent to calling g_date_time_new_now() with the time * zone returned by g_time_zone_new_utc(). * * @newin{2,26} * * @return A new DateTime, or nullptr. */ static DateTime create_now_utc(); /** Creates a DateTime corresponding to the given Unix time @a t in the * local time zone. * * Unix time is the number of seconds that have elapsed since 1970-01-01 * 00:00:00 UTC, regardless of the local time offset. * * This call can fail (returning nullptr) if @a t represents a time outside * of the supported range of DateTime. * * You should release the return value by calling g_date_time_unref() * when you are done with it. * * @newin{2,26} * * @param t The Unix time. * @return A new DateTime, or nullptr. */ static DateTime create_now_local(gint64 t); /** Creates a DateTime corresponding to the given Unix time @a t in UTC. * * Unix time is the number of seconds that have elapsed since 1970-01-01 * 00:00:00 UTC. * * This call can fail (returning nullptr) if @a t represents a time outside * of the supported range of DateTime. * * You should release the return value by calling g_date_time_unref() * when you are done with it. * * @newin{2,26} * * @param t The Unix time. * @return A new DateTime, or nullptr. */ static DateTime create_now_utc(gint64 t); /** Creates a Glib::DateTime corresponding to the given Unix time @a t in the * local time zone. * * Unix time is the number of microseconds that have elapsed since 1970-01-01 * 00:00:00 UTC, regardless of the local time offset. * * This call can fail (returning nullptr) if @a t represents a time outside * of the supported range of DateTime. * * You should release the return value by calling Glib::DateTime::unref() * when you are done with it. * * @newin{2,80} * * @param usecs The Unix time in microseconds. * @return A new Glib::DateTime, or nullptr. */ static DateTime create_from_local_usec(gint64 usecs); /** Creates a Glib::DateTime corresponding to the given Unix time @a t in UTC. * * Unix time is the number of microseconds that have elapsed since 1970-01-01 * 00:00:00 UTC. * * This call can fail (returning nullptr) if @a t represents a time outside * of the supported range of DateTime. * * You should release the return value by calling Glib::DateTime::unref() * when you are done with it. * * @newin{2,80} * * @param usecs The Unix time in microseconds. * @return A new Glib::DateTime, or nullptr. */ static DateTime create_from_utc_usec(gint64 usecs); /** Creates a DateTime corresponding to the given * [ISO 8601 formatted string](https://en.wikipedia.org/wiki/ISO_8601) * @a text. ISO 8601 strings of the form `