Is there a simple way to turn a tm structure into a Glib::DateTime object ?



Suppose I've initialized a tm struct somehow:-

      #include <time.h>
      struct tm date_and_time;
      initialize_date_and_time_somehow (&date_and_time);

Is there a simple way to turn that data into a Glib::DateTime object? I assume I could do something like this:-

      Glib::DateTime tm ( g_date_time_new ( g_time_zone_new (),
                date_and_time.tm_year,   date_and_time.tm_mon ,
                date_and_time.tm_mday,  date_and_time.tm_hour ,
                date_and_time.tm_min,    date_and_time.tm_sec ));

but it all seems a bit convoluted... Have I missed something a lot simpler? Thanks,

John


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