Time in Glibmm and libgdamm



Hi,

My question about Glibmm and libgdamm. I code only in c++. I faced this problem when I wanted to save Date and Time into SQL database using libgdamm. SQL by itself provides two types: DATE and TYPE. They are good match for Glib::Date class, which already exist, and Glib::Time, which doesn't exist. 

I can use GdaTime via std::time_t but this is ugly way for OO. Some other libraries including boost provide class to handle time.

Could please explain me, why we have this situation with Time? It is so ambiguous and confusing. I will be glad to help with implementation of Glib::Time class. 
I would like a solution where Glib::Time and Glib::Date classes are parent classes for Glib::DataTime. It will allow to manipulate DATATIME type in SQL.

Thanks.

From documentation:
typedef gint32  GTime;

Simply a replacement for time_t. It has been deprecated since it is not equivalent to time_t on 64-bit platforms with a 64-bit time_t. Unrelated to GTimer.

Note that GTime is defined to always be a 32-bit integer, unlike time_t which may be 64-bit on some systems. Therefore, GTime will overflow in the year 2038, and you cannot use the address of a GTime variable as argument to the UNIX time() function.


Some time related classes found in Glib and Gnome::Gda namespace
1) Glib::Date
2) Glib::DateTime
3) Glib::TimeVal
4) Gnome::Gda::Timestemp ( or GdaTimestamp)
5) Gnome::Gda::Time ( or GdaTime)



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]