Use cb-versions of gmtime_r and localtime_r

Change-Id: Ib0f761e06ede684e4a160471a073b5196aacd628
Reviewed-on: http://review.couchbase.org/43351
Reviewed-by: Dave Rigby <daver@couchbase.com>
Tested-by: buildbot <build@couchbase.com>