windows - Wrong hour in C++ -
// Simple programs for getting date and time on windows. It compiles and works fine but shows hours incorrectly! // Using Visual C ++ 2008 Express on XP SP2 #include & lt; Windows.h & gt; # Include & lt; Iostream & gt; using namespace std; Zero Main () {System Time St. GetSystemTime (& amp; cents); Cout & lt; & Lt; "Year:" & lt; & Lt; St. Weir & lt; & Lt; "\ N"; Cout & lt; & Lt; "Month:" & lt; & Lt; St. Walmath & lt; & Lt; "\ N"; Cout & lt; & Lt; "Day:" & lt; & Lt; St. Lieutenant; & Lt; "\ N"; // The following line shows incorrect hours, closed up to 4 hours. // what gives? Cout & lt; & Lt; "Hour:" & lt; & Lt; St.wHour & lt; & Lt; "\ N"; Cout & lt; & Lt; "Minutes:" & lt; & Lt; St.wMinute & lt; & Lt; "\ N"; Cout & lt; & Lt; "Second:" & lt; & Lt; St. Vasekind & lt; & Lt; "\ N"; } // TIA people! // - BURT
According to the docs, the time is in UTC. The link
Comments
Post a Comment