// Generated by gmmproc 2.66.3 -- 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 #include #ifndef DOXYGEN_SHOULD_SKIP_THIS typedef struct _GDateTime GDateTime; #endif //TODO: When we can change API, make DateTime a _CLASS_BOXEDTYPE. namespace Glib { struct TimeVal; /** 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 { public: #ifndef DOXYGEN_SHOULD_SKIP_THIS using CppObjectType = DateTime; using BaseObjectType = GDateTime; #endif /* DOXYGEN_SHOULD_SKIP_THIS */ /** Constructs an invalid object. * E.g. for output arguments to methods. There is not much you can do with * the object before it has been assigned a valid value. */ DateTime(); // Use make_a_copy=true when getting it directly from a struct. explicit DateTime(GDateTime* castitem, bool make_a_copy = false); DateTime(const DateTime& src); DateTime& operator=(const DateTime& src); DateTime(DateTime&& other) noexcept; DateTime& operator=(DateTime&& other) noexcept; ~DateTime() noexcept; void swap(DateTime& other) noexcept; GDateTime* gobj() { return gobject_; } 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); #ifndef GLIBMM_DISABLE_DEPRECATED /** Creates a DateTime corresponding to the given TimeVal @a tv in the * local time zone. * * The time contained in a TimeVal is always stored in the form of * seconds elapsed since 1970-01-01 00:00:00 UTC, regardless of the * local time offset. * * This call can fail (returning nullptr) if @a tv 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} * Deprecated: 2.62: TimeVal is not year-2038-safe. Use * g_date_time_new_from_unix_local() instead. * * @deprecated Use create_now_local(gint64 t) instead. * * @param tv A TimeVal. * @return A new DateTime, or nullptr. */ static DateTime create_now_local(const TimeVal& tv); #endif // GLIBMM_DISABLE_DEPRECATED #ifndef GLIBMM_DISABLE_DEPRECATED /** Creates a DateTime corresponding to the given TimeVal @a tv in UTC. * * The time contained in a TimeVal is always stored in the form of * seconds elapsed since 1970-01-01 00:00:00 UTC. * * This call can fail (returning nullptr) if @a tv 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} * Deprecated: 2.62: TimeVal is not year-2038-safe. Use * g_date_time_new_from_unix_utc() instead. * * @deprecated Use create_now_utc(gint64 t) instead. * * @param tv A TimeVal. * @return A new DateTime, or nullptr. */ static DateTime create_now_utc(const TimeVal& tv); #endif // GLIBMM_DISABLE_DEPRECATED /** 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