Bugs are not as simple as that. You must really look for and fix them. That it immediately crashes when you print the hour will help finding it, but a bug in the hour function is not really likely. And it's not your MT version either.

First find out which line crashes, by the method with _POS described in the manual. If it is really the printf line, outcomment systematically code parts until it does not crash anymore. If only the printf remains and still crashes, last hiding place of the bug is your price data - maybe it contains nonsense instead of valid time stamps.

Back to work!