Funktion zum Formatieren einer time_t - Struktur



  • Kann mir bitte jemand helfen?Ich möchte die aktuelle Zeit in der Form "hh🇲🇲ss:ttt" ausgegeben bekommen!Kann mir da jemand helfen?Wäre echt super!Danke im voraus!



  • #include <iostream>
    #include <ctime>
    
    using namespace std;
    
    int main( )
    {
    	time_t now_sec;
    	time( &now_sec );
    
    	tm *now_asc = gmtime( &now_sec );
    
    	cout.fill( '0' );
    	cout.width( 2 );
    	cout << now_asc->tm_hour;
    	cout << ":";
    
    	cout.fill( '0' );
    	cout.width( 2 );
    	cout << now_asc->tm_min;
    	cout << ":";
    
    	cout.fill( '0' );
    	cout.width( 2 );
    	cout << now_asc->tm_sec;
    
    	cout << endl;
    
    	return 0;
    }
    

    das wären hh🇲🇲ss. Aber was zum Teufel ist "ttt"?

    Greetz, Swordfish



  • Tausendstelsekunden


Anmelden zum Antworten