[svn r224] Fixed problem on g_time_val_* functions. trunk
authorrosfran
Mon Dec 18 22:18:57 2006 +0000 (2006-12-18)
branchtrunk
changeset 223657379d8f3b6
parent 222 803672c406ec
child 224 b3cb9c7ec1a9
[svn r224] Fixed problem on g_time_val_* functions.
gmyth/src/gmyth_livetv.c
gmyth/src/gmyth_scheduler.c
gmyth/src/gmyth_tvchain.c
gmyth/src/gmyth_util.c
gmyth/src/gmyth_util.h
     1.1 --- a/gmyth/src/gmyth_livetv.c	Mon Dec 18 18:18:26 2006 +0000
     1.2 +++ b/gmyth/src/gmyth_livetv.c	Mon Dec 18 22:18:57 2006 +0000
     1.3 @@ -321,7 +321,7 @@
     1.4  		res = FALSE;
     1.5  		goto error;
     1.6  	} else {
     1.7 -		gmyth_debug ("[%s] GMythLiveTV: All requests to backend to start TV were OK.\n", __FUNCTION__ );
     1.8 +		gmyth_debug ("GMythLiveTV: All requests to backend to start TV were OK. [%s]\n", livetv->proginfo->pathname->str );
     1.9  	}
    1.10  	
    1.11  	livetv->setup_done = TRUE;
     2.1 --- a/gmyth/src/gmyth_scheduler.c	Mon Dec 18 18:18:26 2006 +0000
     2.2 +++ b/gmyth/src/gmyth_scheduler.c	Mon Dec 18 22:18:57 2006 +0000
     2.3 @@ -291,7 +291,7 @@
     2.4               * we are not using the date field */
     2.5              /* generate a time_t from a time and a date db field */
     2.6              /* g_string_printf (date_time, "%s %s", row[4], row[3]); */
     2.7 -            g_sprintf (date_time, "%s", row[3]); 
     2.8 +            g_sprintf (date_time, "%sT%s", row[4], row[3]); 
     2.9              
    2.10              record->start_time = gmyth_util_string_to_time_val (date_time);
    2.11  
    2.12 @@ -299,7 +299,7 @@
    2.13               * we are not using the date field */
    2.14              /* generate a time_t from a time and a date db field */
    2.15              /* g_string_printf (date_time, "%s %s", row[6], row[5]); */
    2.16 -            g_sprintf (date_time, "%s", row[5]); 
    2.17 +            g_sprintf (date_time, "%sT%s", row[6], row[5]); 
    2.18  
    2.19              record->end_time = gmyth_util_string_to_time_val (date_time);
    2.20  	
    2.21 @@ -374,10 +374,12 @@
    2.22          gmyth_util_time_to_string_only_date( schedule_info->end_time ), 
    2.23          schedule_info->title->str, //title
    2.24      	schedule_info->channel_id,//station
    2.25 -    	g_date_get_weekday( gmyth_util_time_val_to_date( schedule_info->start_time ) ), //findday
    2.26 +    	(gmyth_util_time_val_to_date( schedule_info->start_time ))->tm_wday, //findday
    2.27     		gmyth_util_time_to_string_only_time( schedule_info->start_time ), //findtime
    2.28     		(gint)(schedule_info->start_time->tv_sec/60/60/24 + 719528)//findid
    2.29      );
    2.30 +    
    2.31 +    gmyth_debug ( "Sending query to MySQL = %s.", query_str->str );
    2.32  
    2.33      msql_res = gmyth_query_process_statement (scheduler->msqlquery, query_str->str);
    2.34      
     3.1 --- a/gmyth/src/gmyth_tvchain.c	Mon Dec 18 18:18:26 2006 +0000
     3.2 +++ b/gmyth/src/gmyth_tvchain.c	Mon Dec 18 22:18:57 2006 +0000
     3.3 @@ -132,9 +132,10 @@
     3.4      if (tvchain->tvchain_id == NULL) {
     3.5  	    gchar *isodate = NULL;
     3.6      	GTimeVal *cur_time = g_new0( GTimeVal, 1 );
     3.7 +    	//struct tm* gmyth_util_time_val_to_date ( const GTimeVal* time )
     3.8  
     3.9  	    g_get_current_time(cur_time);
    3.10 -    	isodate = gmyth_util_time_to_isoformat_from_time_val (cur_time);
    3.11 +    	isodate = gmyth_util_time_to_isoformat_from_time_val_fmt ( "%Y-%m-%dT%H:%M:%S", cur_time );
    3.12  
    3.13  	    tvchain->tvchain_id = g_string_sized_new (7 + strlen (hostname) + strlen(isodate));
    3.14      	g_string_printf(tvchain->tvchain_id, 
    3.15 @@ -215,9 +216,9 @@
    3.16  		while ((msql_row = mysql_fetch_row (msql_res)) != NULL) {
    3.17  			struct LiveTVChainEntry *entry = g_new0 (struct LiveTVChainEntry, 1);
    3.18  			entry->chanid = g_string_new (msql_row[0]);
    3.19 -			entry->starttime = gmyth_util_string_to_time_val ((gchar*)msql_row[1]);
    3.20 -			entry->endtime = gmyth_util_string_to_time_val (msql_row[2]);
    3.21 -			entry->discontinuity = atoi (msql_row[3]) != 0;
    3.22 +			entry->starttime = gmyth_util_string_to_time_val ( g_strdup( msql_row[1] ) );
    3.23 +			entry->endtime = gmyth_util_string_to_time_val ( g_strdup( msql_row[2] ) );
    3.24 +			entry->discontinuity = g_ascii_strtoull( msql_row[3], NULL, 10 ) != 0;
    3.25  			entry->hostprefix = g_string_new (msql_row[5]);
    3.26  			entry->cardtype = g_string_new (msql_row[6]);
    3.27  			entry->channum = g_string_new (msql_row[7]);
    3.28 @@ -258,7 +259,7 @@
    3.29  
    3.30  done:
    3.31  	if ( stmt_str != NULL )
    3.32 -		g_string_free (stmt_str, TRUE);
    3.33 +		g_string_free (stmt_str, FALSE);
    3.34  
    3.35  	if ( msql_res != NULL )
    3.36  		mysql_free_result (msql_res);
    3.37 @@ -366,7 +367,7 @@
    3.38  
    3.39  	g_return_val_if_fail( tvchain != NULL, NULL );
    3.40  
    3.41 -	if (!entry || !tvchain) {
    3.42 +	if ( !entry || !tvchain ) {
    3.43  		g_warning ("gmyth_tvchain_entry_to_program() received NULL argument");
    3.44  		return NULL;
    3.45  	}
    3.46 @@ -381,7 +382,7 @@
    3.47  	if (proginfo) {
    3.48  		proginfo->pathname = g_string_prepend (proginfo->pathname, entry->hostprefix->str);
    3.49  	} else {
    3.50 -		g_warning ("tvchain_entry_to_program( chan id = %s, starttime = %ld) failed!", entry->chanid->str, entry->starttime);
    3.51 +		g_warning ("tvchain_entry_to_program( chan id = %s, starttime = %lld) failed!", entry->chanid->str, entry->starttime);
    3.52  	}
    3.53  
    3.54  	return proginfo;
     4.1 --- a/gmyth/src/gmyth_util.c	Mon Dec 18 18:18:26 2006 +0000
     4.2 +++ b/gmyth/src/gmyth_util.c	Mon Dec 18 22:18:57 2006 +0000
     4.3 @@ -31,11 +31,13 @@
     4.4  
     4.5  #define _XOPEN_SOURCE
     4.6  #define _XOPEN_SOURCE_EXTENDED
     4.7 +#define __USE_MISC
     4.8  
     4.9  #include <glib.h>
    4.10  #include <glib/gprintf.h>
    4.11  #include <time.h>
    4.12  #include <sys/time.h>
    4.13 +#include <sys/timex.h>
    4.14  
    4.15  #include "gmyth.h"
    4.16  
    4.17 @@ -82,7 +84,7 @@
    4.18  		tm_time.tm_hour, tm_time.tm_min, tm_time.tm_sec);
    4.19  		
    4.20  	gmyth_debug( "Result (ISO 8601) = %s", result->str );
    4.21 -		
    4.22 +
    4.23  	g_static_mutex_unlock ( &mutex );
    4.24  	
    4.25  	return result;
    4.26 @@ -99,8 +101,8 @@
    4.27   * @param time_value the GTimeValue to be converted
    4.28   * @return GString* the converted isoformat string 
    4.29   */
    4.30 -static gchar*
    4.31 -gmyth_util_time_to_isoformat_from_time_val_fmt ( const gchar *fmt_string, GTimeVal* time_val )
    4.32 +gchar*
    4.33 +gmyth_util_time_to_isoformat_from_time_val_fmt ( const gchar *fmt_string, const GTimeVal* time_val )
    4.34  {
    4.35  	
    4.36  	gchar *result = NULL;
    4.37 @@ -108,23 +110,24 @@
    4.38  	
    4.39  	gint buffer_len = 0;
    4.40  	
    4.41 -	g_return_val_if_fail( fmt_string != NULL, NULL );	
    4.42 +	g_return_val_if_fail( fmt_string != NULL, NULL );
    4.43 +		
    4.44  	g_return_val_if_fail( time_val != NULL, NULL );
    4.45   
    4.46 -	time_t time = time_val->tv_sec + (gint)(time_val->tv_usec / G_USEC_PER_SEC);
    4.47 +	time_t time = time_val->tv_sec;// + (gint)( time_val->tv_usec / G_USEC_PER_SEC );
    4.48  
    4.49  	tm_time = g_malloc0( sizeof(struct tm) );
    4.50  
    4.51  	g_static_mutex_lock ( &mutex );
    4.52  	
    4.53 -	if ( NULL == gmtime_r( &time, tm_time ) ) {
    4.54 +	if ( NULL == localtime_r( &time, tm_time ) ) {
    4.55  		g_warning ("gmyth_util_time_to_isoformat convertion error!\n");
    4.56  	}	else {
    4.57  		// we first check the return of strftime to allocate a buffer of the correct size
    4.58  	  buffer_len = strftime( NULL, SSIZE_MAX, fmt_string, tm_time );
    4.59 -	  if( buffer_len > 0 ){
    4.60 +	  if ( buffer_len > 0 ) {
    4.61  	    result = g_malloc0( buffer_len + 1 );
    4.62 -	    if( result == NULL ){     
    4.63 +	    if( result == NULL ){
    4.64  				g_static_mutex_unlock ( &mutex );
    4.65  				g_warning ("gmyth_util_time_to_isoformat convertion error!\n");
    4.66  				return NULL;
    4.67 @@ -135,15 +138,7 @@
    4.68  		
    4.69  	}
    4.70  	
    4.71 -	/* 
    4.72 -	if ( NULL == asctime_r( tm_time, result ) ) {
    4.73 -		g_static_mutex_unlock ( &mutex );
    4.74 -		g_warning ("gmyth_util_time_to_isoformat convertion error!\n");
    4.75 -    return NULL;
    4.76 -	}
    4.77 -	*/
    4.78 -	
    4.79 -	gmyth_debug( "Result (after asctime_r) = %s", result );
    4.80 +	gmyth_debug( "Result (strftime) = %s", result );
    4.81  	
    4.82  	//strptime( result, "%Y-%m-%dT%H:%M:%SZ", tm_time ); 
    4.83  	
    4.84 @@ -167,9 +162,9 @@
    4.85   * @return GString* the converted isoformat string 
    4.86   */
    4.87  gchar*
    4.88 -gmyth_util_time_to_isoformat_from_time_val ( GTimeVal* time )
    4.89 +gmyth_util_time_to_isoformat_from_time_val ( const GTimeVal* time )
    4.90  {
    4.91 -	gchar *result = gmyth_util_time_to_isoformat_from_time_val_fmt( "%Y-%m-%dT%T", time );
    4.92 +	gchar *result = gmyth_util_time_to_isoformat_from_time_val_fmt( "%Y-%m-%d %H:%M:%S", time );
    4.93  	//result[10] = ' ';
    4.94  	//result[ strlen(result) - 1] = '\0';
    4.95  	
    4.96 @@ -186,11 +181,11 @@
    4.97   * @return GString* the converted isoformat string 
    4.98   */
    4.99  gchar*
   4.100 -gmyth_util_time_to_string_only_date ( GTimeVal* time )
   4.101 +gmyth_util_time_to_string_only_date ( const GTimeVal* time )
   4.102  {
   4.103 -	gchar *result = gmyth_util_time_to_isoformat_from_time_val_fmt( "%y-%m-%d", time );
   4.104 -	result[10] = ' ';
   4.105 -	result[ strlen(result) - 1] = '\0';
   4.106 +	gchar *result = gmyth_util_time_to_isoformat_from_time_val_fmt( "%Y-%m-%d", time );
   4.107 +	//result[10] = ' ';
   4.108 +	//result[ strlen(result) - 1] = '\0';
   4.109  	return result;
   4.110  }
   4.111  
   4.112 @@ -204,11 +199,11 @@
   4.113   * @return GString* the converted isoformat string 
   4.114   */
   4.115  gchar*
   4.116 -gmyth_util_time_to_string_only_time ( GTimeVal* time )
   4.117 +gmyth_util_time_to_string_only_time ( const GTimeVal* time )
   4.118  {
   4.119 -	gchar *result = gmyth_util_time_to_isoformat_from_time_val_fmt( "%T", time );
   4.120 -	result[10] = ' ';
   4.121 -	result[ strlen(result) - 1] = '\0';
   4.122 +	gchar *result = gmyth_util_time_to_isoformat_from_time_val_fmt( "%H:%M:%S", time );	 
   4.123 +	//result[10] = ' ';
   4.124 +	//result[ strlen(result) - 1] = '\0';
   4.125  	return result;
   4.126  }
   4.127  
   4.128 @@ -226,6 +221,7 @@
   4.129  {
   4.130  	GString *result = gmyth_util_time_to_isoformat (time_value);
   4.131  	result->str[10] = ' ';	
   4.132 +	result->str[ strlen(result->str) - 1] = '\0';
   4.133  
   4.134  	return result;
   4.135  }
   4.136 @@ -240,10 +236,10 @@
   4.137   * @return GString* the converted string 
   4.138   */
   4.139  gchar*
   4.140 -gmyth_util_time_to_string_from_time_val (GTimeVal *time_val)
   4.141 +gmyth_util_time_to_string_from_time_val ( const GTimeVal *time_val )
   4.142  {
   4.143 -	gchar *result = gmyth_util_time_to_isoformat_from_time_val (time_val);
   4.144 -	result[10] = ' ';
   4.145 +	gchar *result = gmyth_util_time_to_isoformat_from_time_val_fmt ( "%Y-%m-%d %H:%M:%S", time_val );
   4.146 +	//result[10] = ' ';
   4.147  
   4.148  	return result;
   4.149  }
   4.150 @@ -257,46 +253,26 @@
   4.151  time_t
   4.152  gmyth_util_string_to_time (GString* time_str)
   4.153  {
   4.154 -	//gint year, month, day, hour, min, sec;
   4.155 -	GDate *date = g_date_new();
   4.156 +	gint year, month, day, hour, min, sec;
   4.157      
   4.158  	gmyth_debug( "[%s] time_str = %s. [%s]\n", __FUNCTION__, time_str != NULL ? 
   4.159 -					time_str->str : "[time string is NULL!]", g_strdelimit( time_str->str, " ", 'T' ) );
   4.160 +					time_str->str : "[time string is NULL!]", time_str->str );
   4.161  
   4.162 -
   4.163 -	//if (sscanf (time_str->str, "%04d-%02d-%02d %02d:%02d:%02d",
   4.164 -	//		&year, &month, &day, &hour, &min, &sec) < 3) {				
   4.165 -	//g_date_set_parse( date, time_str->str );
   4.166 -  if ( NULL == date ) { 
   4.167 +	if ( sscanf (time_str->str, "%04d-%02d-%02d %02d:%02d:%02d",
   4.168 +			&year, &month, &day, &hour, &min, &sec) < 3 ) {
   4.169  		g_warning ("GMythUtil: isoformat_to_time converter error!\n");
   4.170  		return 0;
   4.171  	}
   4.172  	
   4.173  	g_static_mutex_lock ( &mutex );
   4.174 -	//GDate *date = g_date_new_dmy( day, month - 1, year - 1900 );
   4.175  	
   4.176  	struct tm* tm_time = g_malloc0( sizeof(struct tm) );
   4.177 -/*		
   4.178 -		tm_time->tm_year = year - 1900;
   4.179 -		tm_time->tm_mon = month - 1;
   4.180 -		tm_time->tm_mday = day;
   4.181 -		tm_time->tm_hour = hour;
   4.182 -		tm_time->tm_min = min;
   4.183 -		tm_time->tm_sec = sec;
   4.184 -	*/
   4.185 -	
   4.186 -	GTimeVal *time = g_new0( GTimeVal, 1 ); 
   4.187 -	
   4.188 -	if ( !g_time_val_from_iso8601( g_strdelimit( time_str->str, " ", 'T' ), time ) )
   4.189 -	{
   4.190 -		gmyth_debug( "ERROR! Problems converting to GTimeVal == %s\n", g_time_val_to_iso8601( time ) );
   4.191 -	} 
   4.192 -	
   4.193 -	gmyth_debug( "Converted to GTimeVal == %s\n", g_time_val_to_iso8601( time ) );
   4.194 -	
   4.195 -	g_date_set_time_val( date, time );
   4.196 -	
   4.197 -	g_date_to_struct_tm( date, tm_time ); 
   4.198 +	tm_time->tm_year = year - 1900;
   4.199 +	tm_time->tm_mon = month - 1;
   4.200 +	tm_time->tm_mday = day;
   4.201 +	tm_time->tm_hour = hour;
   4.202 +	tm_time->tm_min = min;
   4.203 +	tm_time->tm_sec = sec;
   4.204  	
   4.205  	g_static_mutex_unlock ( &mutex );
   4.206  	
   4.207 @@ -309,19 +285,23 @@
   4.208   * @param time_str the string to be converted
   4.209   * @return time_t the time converted value
   4.210   */
   4.211 -GDate *
   4.212 -gmyth_util_time_val_to_date (GTimeVal* time)
   4.213 +struct tm*
   4.214 +gmyth_util_time_val_to_date ( const GTimeVal* time )
   4.215  {
   4.216 -	GDate *date = g_date_new();
   4.217 +	struct tm *date = g_malloc0( sizeof( struct tm ) );
   4.218 +	time_t time_micros = time->tv_sec;// + (gint)( time->tv_usec / G_USEC_PER_SEC );
   4.219      
   4.220    if ( NULL == date ) { 
   4.221 -		g_warning ("GMythUtil: GDate *gmyth_util_time_val_to_date (GTimeVal* time) - converter error!\n");
   4.222 -		return 0;
   4.223 +		g_warning ( "GMythUtil: GDate *gmyth_util_time_val_to_date (GTimeVal* time) - converter error!\n" );
   4.224 +		return NULL;
   4.225  	}
   4.226  	
   4.227 -	g_date_set_time_val( date, time );
   4.228 -	
   4.229 -	gmyth_debug( "Converted from GTimeVal == %s to GDate\n", g_time_val_to_iso8601( time ) );
   4.230 +	if ( NULL == localtime_r( &time_micros, date ) ) {
   4.231 +		g_warning ( "gmyth_util_time_to_isoformat convertion error!\n" );
   4.232 +		return NULL;
   4.233 +	}
   4.234 +
   4.235 +	gmyth_debug( "Converted from GTimeVal == %s to GDate\n", asctime( date ) );
   4.236  	
   4.237  	return date;
   4.238  }
   4.239 @@ -333,28 +313,73 @@
   4.240   * @return time_t the time converted value
   4.241   */
   4.242  GTimeVal*
   4.243 -gmyth_util_string_to_time_val (gchar* time_str)
   4.244 +gmyth_util_string_to_time_val_fmt ( const gchar *fmt_string, const gchar* time_str )
   4.245  {
   4.246 -	GTimeVal *time = g_new0( GTimeVal, 1 ); 
   4.247 +	GTimeVal *time = g_new0( GTimeVal, 1 );
   4.248 +	struct tm* tm_time = NULL;
   4.249 +	time_t time_micros;
   4.250 +	gchar *result = NULL;
   4.251      
   4.252 -	gmyth_debug( "[%s] time_str = %s. [%s]\n", __FUNCTION__, time_str != NULL ? 
   4.253 -					time_str : "[time string is NULL!]", g_strdelimit( time_str, " ", 'T' ) );
   4.254 +	gmyth_debug( "[%s] time_str = %s. [%s]\n", time_str, time_str != NULL ? 
   4.255 +					time_str : "[time string is NULL!]", time_str );
   4.256  
   4.257 -  if ( NULL == time ) { 
   4.258 +  if ( NULL == time_str ) { 
   4.259  		g_warning ("GMythUtil: isoformat_to_time converter error!\n");
   4.260 -		return NULL;
   4.261 +		time = NULL;
   4.262 +		goto done;
   4.263  	}
   4.264  	
   4.265  	g_static_mutex_lock ( &mutex );
   4.266  	
   4.267 -	if ( !g_time_val_from_iso8601( g_strdelimit( time_str, " ", 'T' ), time ) )
   4.268 -	{
   4.269 -		gmyth_debug( "ERROR! Problems converting to GTimeVal == %s\n", g_strdelimit( time_str, " ", 'T' ) );
   4.270 -	} 
   4.271 +	tm_time = g_malloc0( sizeof(struct tm) );
   4.272 +
   4.273 +	/* we first check the return of strftime to allocate a buffer of the correct size */
   4.274 +  result = strptime( time_str, "%Y-%m-%dT%H:%M:%S", tm_time );
   4.275 +  if ( NULL == result ) {
   4.276 +		/* we first check the return of strftime to allocate a buffer of the correct size */
   4.277 +	  result = strptime( time_str, "%Y-%m-%dT%H:%M:%SZ", tm_time );
   4.278 +	  if ( NULL == result ) {
   4.279 +	  	/* we first check the return of strftime to allocate a buffer of the correct size */
   4.280 +		  result = strptime( time_str, "%Y-%m-%d %H:%M:%S", tm_time );
   4.281 +		  if ( NULL == result ) {
   4.282 +		  	g_static_mutex_unlock ( &mutex );
   4.283 +		    gmyth_debug( "Dateline (ISO result): %s\n", result );
   4.284 +		    time = NULL;
   4.285 +		    goto done;	    
   4.286 +		  }
   4.287 +	  }
   4.288 +  }
   4.289 +  
   4.290 +  time_micros = mktime( tm_time );
   4.291 +		
   4.292 +	time->tv_sec = time_micros; // + (gint)( time_val->tv_usec / G_USEC_PER_SEC );
   4.293  	
   4.294 -	gmyth_debug( "Converted to GTimeVal == %s\n", g_time_val_to_iso8601( time ) );
   4.295 +	//strftime( result, SSIZE_MAX, "%Y-%m-%dT%H:%M:%S", tm_time );
   4.296  	
   4.297 +	gmyth_debug( "After mktime call... = %s", asctime(tm_time) );
   4.298 +
   4.299  	g_static_mutex_unlock ( &mutex );
   4.300 +
   4.301 +done:	
   4.302 +	//if ( tm_time )
   4.303 +	//	g_free( tm_time );
   4.304 +		
   4.305 +	//if ( result )
   4.306 +	//	g_free( result );		
   4.307 +	
   4.308 +	return time;
   4.309 +}
   4.310 +
   4.311 +/** Converts a GString in the following format 
   4.312 + * (e.g. 2006-07-20 09:56:41) to a time_t struct.
   4.313 + * 
   4.314 + * @param time_str the string to be converted
   4.315 + * @return time_t the time converted value
   4.316 + */
   4.317 +GTimeVal*
   4.318 +gmyth_util_string_to_time_val ( const gchar* time_str )
   4.319 +{
   4.320 +	GTimeVal *time = gmyth_util_string_to_time_val_fmt ( "%Y-%m-%d %H:%M:%S", time_str );	
   4.321  	
   4.322  	return time;
   4.323  }
     5.1 --- a/gmyth/src/gmyth_util.h	Mon Dec 18 18:18:26 2006 +0000
     5.2 +++ b/gmyth/src/gmyth_util.h	Mon Dec 18 22:18:57 2006 +0000
     5.3 @@ -41,18 +41,22 @@
     5.4  time_t      gmyth_util_string_to_time   (GString* time_str);
     5.5  gint64     	gmyth_util_decode_long_long (GMythStringList *strlist, 
     5.6                                           guint offset);
     5.7 +
     5.8 +gchar* 			gmyth_util_time_to_isoformat_from_time_val_fmt ( const gchar *fmt_string, const GTimeVal* time_val );
     5.9 +
    5.10 +GTimeVal		*gmyth_util_string_to_time_val_fmt ( const gchar *fmt_string, const gchar* time_str );
    5.11                                           
    5.12 -GTimeVal		*gmyth_util_string_to_time_val (gchar* time_str);
    5.13 +GTimeVal		*gmyth_util_string_to_time_val ( const gchar* time_str );
    5.14  
    5.15 -gchar 			*gmyth_util_time_to_isoformat_from_time_val(GTimeVal *time);
    5.16 +gchar 			*gmyth_util_time_to_isoformat_from_time_val( const GTimeVal *time);
    5.17  
    5.18 -gchar				*gmyth_util_time_to_string_only_date ( GTimeVal* time );
    5.19 +gchar				*gmyth_util_time_to_string_only_date ( const GTimeVal* time );
    5.20  
    5.21 -gchar				*gmyth_util_time_to_string_only_time ( GTimeVal* time );
    5.22 +gchar				*gmyth_util_time_to_string_only_time ( const GTimeVal* time );
    5.23  
    5.24 -gchar				*gmyth_util_time_to_string_from_time_val (GTimeVal *time_val);
    5.25 +gchar				*gmyth_util_time_to_string_from_time_val ( const GTimeVal *time_val );
    5.26  
    5.27 -GDate 			*gmyth_util_time_val_to_date (GTimeVal* time);
    5.28 +struct tm		*gmyth_util_time_val_to_date ( const GTimeVal* time );
    5.29  
    5.30  gboolean 		gmyth_util_file_exists (GMythBackendInfo *backend_info, const gchar* filename);
    5.31