Wieso geht meine Systemzeit falsch ???



  • Hi, ich hole mir die Systemzeit mit

    SYSTEMTIME times;
    
        char cYear[10];
        char cMonth[10]; 
        char cDay[10];  
        char cHour[10];
        char cMin[10]; 
        char cSec[10];   
    
        GetSystemTime (&times);
    
        int iYear   = times.wYear;
        int iMonth  = times.wMonth;
        int iDay    = times.wDay;
        int iHour   = times.wHour;
        int iMin    = times.wMinute;
        int iSec    = times.wSecond;
    
        sprintf(cYear , "%g" , (double)iYear);
        sprintf(cMonth , "%g" , (double)iMonth);
        sprintf(cDay , "%g" , (double)iDay);   
        sprintf(cHour , "%g" , (double)iHour);
        sprintf(cMin , "%g" , (double)iMin);
        sprintf(cSec , "%g" , (double)iSec);
    
        strcpy(fulltime,cDay);
        strcat(fulltime,".");    
        strcat(fulltime,cMonth);
        strcat(fulltime,".");       
        strcat(fulltime,cYear);
        strcat(fulltime,"_");        
    
        strcat(fulltime,cHour);
        strcat(fulltime,"-");        
        strcat(fulltime,cMin);
        strcat(fulltime,"-");       
        strcat(fulltime,cSec);
    
        cout << fulltime;
    

    So das funktioniert, aber diese Zeit geht immer etwa 2 stunden nach als die Zeit, die unten rechts im windows steht... WARUM ??
    Ist diese Windows Uhr etwa nicht die Systemzeit ??? Oder hat das was mit Sommer/WInter/ GTM + 1:00 zu tun ? Und wie könnte ich das umgehen ?

    Gruß



  • Foxx90 schrieb:

    Und wie könnte ich das umgehen ?

    Mit "GetLocalTime ()".



  • Perfekt danke 🙂


Anmelden zum Antworten