X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=glib%2Fgdatetime.c;h=cbbf620088f9a70a1696a057e1496d43e33f75f0;hb=14f2376c8a06f0936d734ec6a7e0e836072acf65;hp=f7f4ba2a98c1c1108484aa99867735d136b7c917;hpb=6ed60a936cf4a220519195c456c3eaa5ddec66b4;p=platform%2Fupstream%2Fglib.git diff --git a/glib/gdatetime.c b/glib/gdatetime.c index f7f4ba2..cbbf620 100644 --- a/glib/gdatetime.c +++ b/glib/gdatetime.c @@ -50,10 +50,6 @@ #include #include -#ifdef HAVE_UNISTD_H -#include -#endif - #ifdef HAVE_LANGINFO_TIME #include #endif @@ -442,7 +438,7 @@ g_date_time_alloc (GTimeZone *tz) * * Atomically increments the reference count of @datetime by one. * - * Return value: the #GDateTime with the reference count increased + * Returns: the #GDateTime with the reference count increased * * Since: 2.26 */ @@ -948,6 +944,8 @@ g_date_time_new (GTimeZone *tz, GDateTime *datetime; gint64 full_time; + g_return_val_if_fail (tz != NULL, NULL); + if (year < 1 || year > 9999 || month < 1 || month > 12 || day < 1 || day > 31 || @@ -1063,7 +1061,7 @@ g_date_time_new_utc (gint year, * * Creates a copy of @datetime and adds the specified timespan to the copy. * - * Return value: the newly created #GDateTime which should be freed with + * Returns: the newly created #GDateTime which should be freed with * g_date_time_unref(). * * Since: 2.26 @@ -1084,7 +1082,7 @@ g_date_time_add (GDateTime *datetime, * Creates a copy of @datetime and adds the specified number of years to the * copy. Add negative values to subtract years. * - * Return value: the newly created #GDateTime which should be freed with + * Returns: the newly created #GDateTime which should be freed with * g_date_time_unref(). * * Since: 2.26 @@ -1119,7 +1117,7 @@ g_date_time_add_years (GDateTime *datetime, * Creates a copy of @datetime and adds the specified number of months to the * copy. Add negative values to subtract months. * - * Return value: the newly created #GDateTime which should be freed with + * Returns: the newly created #GDateTime which should be freed with * g_date_time_unref(). * * Since: 2.26 @@ -1162,7 +1160,7 @@ g_date_time_add_months (GDateTime *datetime, * Creates a copy of @datetime and adds the specified number of weeks to the * copy. Add negative values to subtract weeks. * - * Return value: the newly created #GDateTime which should be freed with + * Returns: the newly created #GDateTime which should be freed with * g_date_time_unref(). * * Since: 2.26 @@ -1184,7 +1182,7 @@ g_date_time_add_weeks (GDateTime *datetime, * Creates a copy of @datetime and adds the specified number of days to the * copy. Add negative values to subtract days. * - * Return value: the newly created #GDateTime which should be freed with + * Returns: the newly created #GDateTime which should be freed with * g_date_time_unref(). * * Since: 2.26 @@ -1209,7 +1207,7 @@ g_date_time_add_days (GDateTime *datetime, * Creates a copy of @datetime and adds the specified number of hours. * Add negative values to subtract hours. * - * Return value: the newly created #GDateTime which should be freed with + * Returns: the newly created #GDateTime which should be freed with * g_date_time_unref(). * * Since: 2.26 @@ -1229,7 +1227,7 @@ g_date_time_add_hours (GDateTime *datetime, * Creates a copy of @datetime adding the specified number of minutes. * Add negative values to subtract minutes. * - * Return value: the newly created #GDateTime which should be freed with + * Returns: the newly created #GDateTime which should be freed with * g_date_time_unref(). * * Since: 2.26 @@ -1250,7 +1248,7 @@ g_date_time_add_minutes (GDateTime *datetime, * Creates a copy of @datetime and adds the specified number of seconds. * Add negative values to subtract seconds. * - * Return value: the newly created #GDateTime which should be freed with + * Returns: the newly created #GDateTime which should be freed with * g_date_time_unref(). * * Since: 2.26 @@ -1275,7 +1273,7 @@ g_date_time_add_seconds (GDateTime *datetime, * Creates a new #GDateTime adding the specified values to the current date and * time in @datetime. Add negative values to subtract. * - * Return value: the newly created #GDateTime that should be freed with + * Returns: the newly created #GDateTime that should be freed with * g_date_time_unref(). * * Since: 2.26 @@ -1371,7 +1369,7 @@ g_date_time_add_full (GDateTime *datetime, * A comparison function for #GDateTimes that is suitable * as a #GCompareFunc. Both #GDateTimes must be non-%NULL. * - * Return value: -1, 0 or 1 if @dt1 is less than, equal to or greater + * Returns: -1, 0 or 1 if @dt1 is less than, equal to or greater * than @dt2. * * Since: 2.26 @@ -1403,7 +1401,7 @@ g_date_time_compare (gconstpointer dt1, * #GTimeSpan that is returned is effectively @end - @begin (ie: * positive if the first parameter is larger). * - * Return value: the difference between the two #GDateTime, as a time + * Returns: the difference between the two #GDateTime, as a time * span expressed in microseconds. * * Since: 2.26 @@ -1425,7 +1423,7 @@ g_date_time_difference (GDateTime *end, * * Hashes @datetime into a #guint, suitable for use within #GHashTable. * - * Return value: a #guint containing the hash + * Returns: a #guint containing the hash * * Since: 2.26 */ @@ -1445,7 +1443,7 @@ g_date_time_hash (gconstpointer datetime) * Equal here means that they represent the same moment after converting * them to the same time zone. * - * Return value: %TRUE if @dt1 and @dt2 are equal + * Returns: %TRUE if @dt1 and @dt2 are equal * * Since: 2.26 */ @@ -1559,7 +1557,7 @@ end: * * Retrieves the year represented by @datetime in the Gregorian calendar. * - * Return value: the year represented by @datetime + * Returns: the year represented by @datetime * * Since: 2.26 */ @@ -1582,7 +1580,7 @@ g_date_time_get_year (GDateTime *datetime) * Retrieves the month of the year represented by @datetime in the Gregorian * calendar. * - * Return value: the month represented by @datetime + * Returns: the month represented by @datetime * * Since: 2.26 */ @@ -1605,7 +1603,7 @@ g_date_time_get_month (GDateTime *datetime) * Retrieves the day of the month represented by @datetime in the gregorian * calendar. * - * Return value: the day of the month + * Returns: the day of the month * * Since: 2.26 */ @@ -1753,7 +1751,7 @@ g_date_time_get_week_of_year (GDateTime *datetime) * Retrieves the ISO 8601 day of the week on which @datetime falls (1 is * Monday, 2 is Tuesday... 7 is Sunday). * - * Return value: the day of the week + * Returns: the day of the week * * Since: 2.26 */ @@ -1773,7 +1771,7 @@ g_date_time_get_day_of_week (GDateTime *datetime) * Retrieves the day of the year represented by @datetime in the Gregorian * calendar. * - * Return value: the day of the year + * Returns: the day of the year * * Since: 2.26 */ @@ -1796,7 +1794,7 @@ g_date_time_get_day_of_year (GDateTime *datetime) * * Retrieves the hour of the day represented by @datetime * - * Return value: the hour of the day + * Returns: the hour of the day * * Since: 2.26 */ @@ -1814,7 +1812,7 @@ g_date_time_get_hour (GDateTime *datetime) * * Retrieves the minute of the hour represented by @datetime * - * Return value: the minute of the hour + * Returns: the minute of the hour * * Since: 2.26 */ @@ -1832,7 +1830,7 @@ g_date_time_get_minute (GDateTime *datetime) * * Retrieves the second of the minute represented by @datetime * - * Return value: the second represented by @datetime + * Returns: the second represented by @datetime * * Since: 2.26 */ @@ -1850,7 +1848,7 @@ g_date_time_get_second (GDateTime *datetime) * * Retrieves the microsecond of the date represented by @datetime * - * Return value: the microsecond of the second + * Returns: the microsecond of the second * * Since: 2.26 */ @@ -2544,266 +2542,81 @@ g_date_time_format_locale (GDateTime *datetime, * * The following format specifiers are supported: * - * - * - * \%a: - * - * the abbreviated weekday name according to the current locale - * - * - * \%A: - * - * the full weekday name according to the current locale - * - * - * \%b: - * - * the abbreviated month name according to the current locale - * - * - * \%B: - * - * the full month name according to the current locale - * - * - * \%c: - * - * the preferred date and time representation for the current locale - * - * - * \%C: - * - * The century number (year/100) as a 2-digit integer (00-99) - * - * - * \%d: - * - * the day of the month as a decimal number (range 01 to 31) - * - * - * \%e: - * - * the day of the month as a decimal number (range 1 to 31) - * - * - * \%F: - * - * equivalent to \%Y-\%m-\%d (the ISO 8601 date - * format) - * - * - * \%g: - * - * the last two digits of the ISO 8601 week-based year as a decimal - * number (00-99). This works well with \%V and \%u. - * - * - * \%G: - * - * the ISO 8601 week-based year as a decimal number. This works well - * with \%V and \%u. - * - * - * \%h: - * - * equivalent to \%b - * - * - * \%H: - * - * the hour as a decimal number using a 24-hour clock (range 00 to - * 23) - * - * - * \%I: - * - * the hour as a decimal number using a 12-hour clock (range 01 to - * 12) - * - * - * \%j: - * - * the day of the year as a decimal number (range 001 to 366) - * - * - * \%k: - * - * the hour (24-hour clock) as a decimal number (range 0 to 23); - * single digits are preceded by a blank - * - * - * \%l: - * - * the hour (12-hour clock) as a decimal number (range 1 to 12); - * single digits are preceded by a blank - * - * - * \%m: - * - * the month as a decimal number (range 01 to 12) - * - * - * \%M: - * - * the minute as a decimal number (range 00 to 59) - * - * - * \%p: - * - * either "AM" or "PM" according to the given time value, or the - * corresponding strings for the current locale. Noon is treated as - * "PM" and midnight as "AM". - * - * - * \%P: - * - * like \%p but lowercase: "am" or "pm" or a corresponding string for - * the current locale - * - * - * \%r: - * - * the time in a.m. or p.m. notation - * - * - * \%R: - * - * the time in 24-hour notation (\%H:\%M) - * - * - * \%s: - * - * the number of seconds since the Epoch, that is, since 1970-01-01 - * 00:00:00 UTC - * - * - * \%S: - * - * the second as a decimal number (range 00 to 60) - * - * - * \%t: - * - * a tab character - * - * - * \%T: - * - * the time in 24-hour notation with seconds (\%H:\%M:\%S) - * - * - * \%u: - * - * the ISO 8601 standard day of the week as a decimal, range 1 to 7, - * Monday being 1. This works well with \%G and \%V. - * - * - * \%V: - * - * the ISO 8601 standard week number of the current year as a decimal - * number, range 01 to 53, where week 1 is the first week that has at - * least 4 days in the new year. See g_date_time_get_week_of_year(). - * This works well with \%G and \%u. - * - * - * \%w: - * - * the day of the week as a decimal, range 0 to 6, Sunday being 0. - * This is not the ISO 8601 standard format -- use \%u instead. - * - * - * \%x: - * - * the preferred date representation for the current locale without - * the time - * - * - * \%X: - * - * the preferred time representation for the current locale without - * the date - * - * - * \%y: - * - * the year as a decimal number without the century - * - * - * \%Y: - * - * the year as a decimal number including the century - * - * - * \%z: - * - * the time zone as an offset from UTC (+hhmm) - * - * - * \%:z: - * - * the time zone as an offset from UTC (+hh:mm). This is a gnulib strftime extension. Since: 2.38 - * - * - * \%::z: - * - * the time zone as an offset from UTC (+hh:mm:ss). This is a gnulib strftime extension. Since: 2.38 - * - * - * \%:::z: - * - * the time zone as an offset from UTC, with : to necessary precision - * (e.g., -04, +05:30). This is a gnulib strftime extension. Since: 2.38 - * - * - * \%Z: - * - * the time zone or name or abbreviation - * - * - * \%\%: - * - * a literal \% character - * - * + * - \%a: the abbreviated weekday name according to the current locale + * - \%A: the full weekday name according to the current locale + * - \%b: the abbreviated month name according to the current locale + * - \%B: the full month name according to the current locale + * - \%c: the preferred date and time rpresentation for the current locale + * - \%C: the century number (year/100) as a 2-digit integer (00-99) + * - \%d: the day of the month as a decimal number (range 01 to 31) + * - \%e: the day of the month as a decimal number (range 1 to 31) + * - \%F: equivalent to `%Y-%m-%d` (the ISO 8601 date format) + * - \%g: the last two digits of the ISO 8601 week-based year as a + * decimal number (00-99). This works well with \%V and \%u. + * - \%G: the ISO 8601 week-based year as a decimal number. This works + * well with \%V and \%u. + * - \%h: equivalent to \%b + * - \%H: the hour as a decimal number using a 24-hour clock (range 00 to 23) + * - \%I: the hour as a decimal number using a 12-hour clock (range 01 to 12) + * - \%j: the day of the year as a decimal number (range 001 to 366) + * - \%k: the hour (24-hour clock) as a decimal number (range 0 to 23); + * single digits are preceded by a blank + * - \%l: the hour (12-hour clock) as a decimal number (range 1 to 12); + * single digits are preceded by a blank + * - \%m: the month as a decimal number (range 01 to 12) + * - \%M: the minute as a decimal number (range 00 to 59) + * - \%p: either "AM" or "PM" according to the given time value, or the + * corresponding strings for the current locale. Noon is treated as + * "PM" and midnight as "AM". + * - \%P: like \%p but lowercase: "am" or "pm" or a corresponding string for + * the current locale + * - \%r: the time in a.m. or p.m. notation + * - \%R: the time in 24-hour notation (\%H:\%M) + * - \%s: the number of seconds since the Epoch, that is, since 1970-01-01 + * 00:00:00 UTC + * - \%S: the second as a decimal number (range 00 to 60) + * - \%t: a tab character + * - \%T: the time in 24-hour notation with seconds (\%H:\%M:\%S) + * - \%u: the ISO 8601 standard day of the week as a decimal, range 1 to 7, + * Monday being 1. This works well with \%G and \%V. + * - \%V: the ISO 8601 standard week number of the current year as a decimal + * number, range 01 to 53, where week 1 is the first week that has at + * least 4 days in the new year. See g_date_time_get_week_of_year(). + * This works well with \%G and \%u. + * - \%w: the day of the week as a decimal, range 0 to 6, Sunday being 0. + * This is not the ISO 8601 standard format -- use \%u instead. + * - \%x: the preferred date representation for the current locale without + * the time + * - \%X: the preferred time representation for the current locale without + * the date + * - \%y: the year as a decimal number without the century + * - \%Y: the year as a decimal number including the century + * - \%z: the time zone as an offset from UTC (+hhmm) + * - \%:z: the time zone as an offset from UTC (+hh:mm). + * This is a gnulib strftime() extension. Since: 2.38 + * - \%::z: the time zone as an offset from UTC (+hh:mm:ss). This is a + * gnulib strftime() extension. Since: 2.38 + * - \%:::z: the time zone as an offset from UTC, with : to necessary + * precision (e.g., -04, +05:30). This is a gnulib strftime() extension. Since: 2.38 + * - \%Z: the time zone or name or abbreviation + * - \%\%: a literal \% character * * Some conversion specifications can be modified by preceding the * conversion specifier by one or more modifier characters. The * following modifiers are supported for many of the numeric * conversions: - * - * - * O - * - * Use alternative numeric symbols, if the current locale - * supports those. - * - * - * - * _ - * - * Pad a numeric result with spaces. - * This overrides the default padding for the specifier. - * - * - * - * - - * - * Do not pad a numeric result. - * This overrides the default padding for the specifier. - * - * - * - * 0 - * - * Pad a numeric result with zeros. - * This overrides the default padding for the specifier. - * - * - * + * + * - O: Use alternative numeric symbols, if the current locale supports those. + * - _: Pad a numeric result with spaces. This overrides the default padding + * for the specifier. + * - -: Do not pad a numeric result. This overrides the default padding + * for the specifier. + * - 0: Pad a numeric result with zeros. This overrides the default padding + * for the specifier. * * Returns: a newly allocated string formatted to the requested format - * or %NULL in the case that there was an error. The string - * should be freed with g_free(). + * or %NULL in the case that there was an error. The string + * should be freed with g_free(). * * Since: 2.26 */