After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 335425 - Add ISO8601 timestamp conversion functions
Add ISO8601 timestamp conversion functions
Status: RESOLVED FIXED
Product: glib
Classification: Platform
Component: general
2.10.x
Other Linux
: Normal enhancement
: ---
Assigned To: gtkdev
gtkdev
Depends on:
Blocks:
 
 
Reported: 2006-03-21 21:55 UTC by Emmanuele Bassi (:ebassi)
Modified: 2006-03-23 13:11 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
the proposed patch (7.38 KB, patch)
2006-03-21 21:56 UTC, Emmanuele Bassi (:ebassi)
none Details | Review
updated patch (10.07 KB, patch)
2006-03-23 02:48 UTC, Emmanuele Bassi (:ebassi)
none Details | Review

Description Emmanuele Bassi (:ebassi) 2006-03-21 21:55:52 UTC
Many web applications would benefit by having a standard implementation of way to convert timestamps to/from ISO 8601 formatted strings.

The patch below adds two functions which convert ISO 8601 encoded string to and from a GTimeVal.

the iso 8601 parser code is based on the equivalent code from libsoup.
Comment 1 Emmanuele Bassi (:ebassi) 2006-03-21 21:56:37 UTC
Created attachment 61731 [details] [review]
the proposed patch

patch is against GLib HEAD
Comment 2 Matthias Clasen 2006-03-22 19:51:52 UTC
Looks fine to me. Feel free to commit, with the following additions:

a) Add the two new functions to docs/reference/glib/glib-sections.txt, next
  to g_time_val_add

b) Add some tests, maybe in tests/testglib.c (which is our grab bag of tests).
   Probably do some roundtrip tests, and maybe some tests using wierd locales
   to verify that locale does not affect the outcome.
Comment 3 Emmanuele Bassi (:ebassi) 2006-03-23 02:47:13 UTC
okay, new patch addressing a) and b)

if it's okay, I'm going to commit this.
Comment 4 Emmanuele Bassi (:ebassi) 2006-03-23 02:48:01 UTC
Created attachment 61819 [details] [review]
updated patch
Comment 5 Emmanuele Bassi (:ebassi) 2006-03-23 02:56:12 UTC
2006-03-23  Emmanuele Bassi  <ebassi@cvs.gnome.org>

	* configure.in: Check for timegm.
	
	* glib/gtimer.h:
	* glib/gtimer.c:
	* glib/glib.symbols:
	* docs/reference/glib/glib-sections.txt: Added g_time_val_to_iso8601
	and g_time_val_from_iso8601, to convert a GTimeVal to and from an
	ISO 8601 encoded date.

	* tests/testglib.c: Added test cases for g_time_val_to_iso8601()
	and g_time_val_from_iso8601() functions.
Comment 6 Paolo Borelli 2006-03-23 08:06:47 UTC
Sorry to bug in here, but this sounds like an api addition and glib 2.10 is already released. The functions are marked since '2.10' but they are not available in the first version of glib 2.10. Am I missing something obvious?
Comment 7 Emmanuele Bassi (:ebassi) 2006-03-23 11:52:59 UTC
(replying to comment #6):

I can mark these functions as "Since: 2.12", if Matthias is going to release HEAD as 2.12.
Comment 8 Matthias Clasen 2006-03-23 13:11:14 UTC
We forgot to branch first.