fixes for VS2013. introduce cross-platform MT-safe time functions wrappers