loudmouth/lm-utils.c
changeset 168 ac1affcd5d22
parent 155 d24c4392d4e3
child 176 5cddc8cc2f78
equal deleted inserted replaced
167:7bcccfa734e2 168:ac1affcd5d22
   164 
   164 
   165 	return result;
   165 	return result;
   166 #else
   166 #else
   167 	return g_strdup(hostname);
   167 	return g_strdup(hostname);
   168 #endif
   168 #endif
   169 }struct tm *
   169 }
       
   170 
       
   171 struct tm *
   170 lm_utils_get_localtime (const gchar *stamp)
   172 lm_utils_get_localtime (const gchar *stamp)
   171 {
   173 {
   172 	struct tm tm;
   174 	struct tm tm;
   173 	time_t    t;
   175 	time_t    t;
   174 	gint      year, month;
   176 	gint      year, month;
   175 	
   177 	
       
   178 	g_return_val_if_fail (stamp != NULL, NULL);
       
   179 
   176 	/* 20021209T23:51:30 */
   180 	/* 20021209T23:51:30 */
   177 
   181 
   178 	sscanf (stamp, "%4d%2d%2dT%2d:%2d:%2d", 
   182 	sscanf (stamp, "%4d%2d%2dT%2d:%2d:%2d", 
   179 		&year, &month, &tm.tm_mday, &tm.tm_hour,
   183 		&year, &month, &tm.tm_mday, &tm.tm_hour,
   180 		&tm.tm_min, &tm.tm_sec);
   184 		&tm.tm_min, &tm.tm_sec);