Changeset 4842

Show
Ignore:
Timestamp:
01/28/07 01:16:49 (23 months ago)
Author:
flynd
Message:

Added contact local time and time zone to usprintf function

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/licq/src/user.cpp

    r4813 r4842  
    1515#include <fcntl.h> 
    1616#include <netinet/in.h> 
     17#include <ctime> 
    1718#include <ctype.h> 
    1819#include <sys/socket.h> 
     
    29452946        } 
    29462947 
     2948        case 'z': 
     2949        { 
     2950          char zone = GetTimezone(); 
     2951          if (zone == TIMEZONE_UNKNOWN) 
     2952            strcpy(szTemp, tr("Unknown")); 
     2953          else 
     2954            sprintf(szTemp, tr("GMT%c%i%c0"), (zone > 0 ? '-' : '+'), abs(zone / 2), (zone & 1 ? '3' : '0')); 
     2955          sz = szTemp; 
     2956          break; 
     2957        } 
     2958 
     2959        case 'L': 
     2960        { 
     2961          char zone = GetTimezone(); 
     2962          if (zone == TIMEZONE_UNKNOWN) 
     2963            strcpy(szTemp, tr("Unknown")); 
     2964          else 
     2965          { 
     2966            time_t t = time(NULL) - zone*30*60; 
     2967            struct tm ts; 
     2968            strftime(szTemp, 128, "%R", gmtime_r(&t, &ts)); 
     2969          } 
     2970 
     2971          sz = szTemp; 
     2972          break; 
     2973        } 
     2974        case 'F': 
     2975        { 
     2976          char zone = GetTimezone(); 
     2977          if (zone == TIMEZONE_UNKNOWN) 
     2978            strcpy(szTemp, tr("Unknown")); 
     2979          else 
     2980          { 
     2981            time_t t = time(NULL) - zone*30*60; 
     2982            struct tm ts; 
     2983            strftime(szTemp, 128, "%c", gmtime_r(&t, &ts)); 
     2984          } 
     2985 
     2986          sz = szTemp; 
     2987          break; 
     2988        } 
     2989 
    29472990        case 'o': 
    29482991          if(m_nLastCounters[LAST_ONLINE] == 0)