More correct normalizing of timestamp for timezone

- Potential fix for issues #5328 and #5448. 
- Minor code enhancement.