Changeset 12221


Ignore:
Timestamp:
Mar 24, 2011, 6:29:07 PM (12 years ago)
Author:
jordan
Message:

(trunk gtk) gtr_localtime() is only used in one place, so make it a private function there instead of leaving it public in util.h

Location:
trunk/gtk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/gtk/msgwin.c

    r12090 r12221  
    119119    if( pinned_to_new )
    120120        scroll_to_bottom( data );
     121}
     122
     123/* similar to asctime, but is utf8-clean */
     124static char*
     125gtr_localtime( time_t time )
     126{
     127    char buf[256], *eoln;
     128    const struct tm tm = *localtime( &time );
     129
     130    g_strlcpy( buf, asctime( &tm ), sizeof( buf ) );
     131    if( ( eoln = strchr( buf, '\n' ) ) )
     132        *eoln = '\0';
     133
     134    return g_locale_to_utf8( buf, -1, NULL, NULL, NULL );
    121135}
    122136
  • trunk/gtk/util.c

    r12220 r12221  
    211211
    212212    return buf;
    213 }
    214 
    215 char *
    216 gtr_localtime( time_t time )
    217 {
    218     char buf[256], *eoln;
    219     const struct tm tm = *localtime( &time );
    220 
    221     g_strlcpy( buf, asctime( &tm ), sizeof( buf ) );
    222     if( ( eoln = strchr( buf, '\n' ) ) )
    223         *eoln = '\0';
    224 
    225     return g_locale_to_utf8( buf, -1, NULL, NULL, NULL );
    226213}
    227214
  • trunk/gtk/util.h

    r12220 r12221  
    6363/* return a human-readable string for the time given in seconds. */
    6464char* tr_strltime( char * buf, int secs, size_t buflen );
    65 
    66 /* similar to asctime, but is utf8-clean */
    67 char* gtr_localtime( time_t time );
    68 
    6965
    7066int gtr_compare_double( const double a, const double b, int decimal_places );
Note: See TracChangeset for help on using the changeset viewer.