fork download
  1. #include <iostream>
  2. #include <time.h>
  3. #include <sstream>
  4. #include <stdio.h>
  5.  
  6. int main ()
  7. {
  8. // your code goes here
  9.  
  10. time_t rawtime;
  11. struct tm* ptm;
  12. time(&rawtime);
  13. ptm = gmtime(&rawtime);
  14.  
  15. std::stringstream ss;
  16. ss << ptm->tm_hour; // outputs "3" when it should be "9"
  17. printf ("Test: %2d:%02d\n", (ptm->tm_hour)%24, ptm->tm_min);
  18.  
  19. return 0;
  20. }
Success #stdin #stdout 0s 3456KB
stdin
Standard input is empty
stdout
Test:   9:55