Hi I am newbie to c++ but not new to programming. Trying to write a program that will show the Time from various Time zones like Toronto, Mumbai, etc.
The code is below. The problem I am facing is that the time is not displayed correctly and I suspect it has something to do with the time function.
The time for Mumbai should be +5.30 hrs from the UTC/GMT time but it seems to be seeded with the same time as Toronto.
Current Time in UTC : 6:34
Current time
Toronto : 1:34
Mumbai : 7:04
End of Program
The time for Mumbai should be 12.07PM and not 7.04. Seems like Mumbai's time is being set with the same as Toronto and then getting incremented by 5.30 hrs.
both torontoTime and mumbaiTime point to the same (static) object.
Return value
Pointer to a static internal std::tm object on success, or NULL otherwise. The structure may shared between std::gmtime, std::localtime, and std::ctime and may be overwritten on each invocation. - http://en.cppreference.com/w/cpp/chrono/c/gmtime