#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
+#include <sys/time.h>
#include <vconf.h>
gchar *field;
gchar *group_name = NULL;
int order = 0;
+ int rv;
+ struct timeval modified_time;
if ((wifi == NULL) || (config_id == NULL) || (configuration == NULL)) {
ERR("Invalid parameter");
g_key_file_set_boolean(keyfile, group_name, WIFI_CONFIG_FAVORITE, conf->favorite);
g_key_file_set_boolean(keyfile, group_name, WIFI_CONFIG_AUTOCONNECT, conf->autoconnect);
-#if GLIB_CHECK_VERSION(2,62,0)
- gint64 real_time = 0;
- GDateTime *dt_real_time = NULL;
-
- real_time = g_get_real_time();
- dt_real_time = g_date_time_new_from_unix_utc(real_time);
- if (dt_real_time) {
- gchar *str = g_date_time_format_iso8601(dt_real_time);
- g_date_time_unref(dt_real_time);
- if (str) {
- g_key_file_set_string(keyfile, group_name,
- WIFI_CONFIG_MODIFIED, str);
- g_free(str);
+ rv = gettimeofday(&modified_time, NULL);
+ if (!rv) {
+ struct tm modified_tm;
+ char time_buf[255];
+ time_t modified_t = modified_time.tv_sec;
+
+ if (localtime_r(&modified_t, &modified_tm)) {
+ if (strftime(time_buf, sizeof(time_buf), "%FT%TZ", &modified_tm)) {
+ field = g_strdup(time_buf);
+ if (field) {
+ g_key_file_set_string(keyfile, group_name, WIFI_CONFIG_MODIFIED, field);
+ g_free(field);
+ }
+ }
}
}
-#else /* GLIB_CHECK_VERSION(2,62,0) */
- GTimeVal modified;
- g_get_current_time(&modified);
- gchar *str = g_time_val_to_iso8601(&modified);
- if (str) {
- g_key_file_set_string(keyfile, group_name,
- WIFI_CONFIG_MODIFIED, str);
- g_free(str);
- }
-#endif /* GLIB_CHECK_VERSION(2,62,0) */
/* Optional field */
if (conf->proxy_address != NULL) {