From da7c54023d5448c8e37554ebfd7ec1b255dee37e Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Wed, 30 Mar 2011 12:36:54 -0700 Subject: [PATCH] Format timestamps as UTC in ActivityStreams output. While using local times is legit per spec, it's confusing to have it change around and confuses some clients that don't handle zones right. --- lib/activity.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/activity.php b/lib/activity.php index b781e49846..83a115d160 100644 --- a/lib/activity.php +++ b/lib/activity.php @@ -704,11 +704,18 @@ class Activity return ActivityUtils::child($element, $tag, $namespace); } + /** + * For consistency, we'll always output UTC rather than local time. + * Note that clients *should* accept any timezone we give them as long + * as it's properly formatted. + * + * @param int $tm Unix timestamp + * @return string + */ static function iso8601Date($tm) { $dateStr = date('d F Y H:i:s', $tm); $d = new DateTime($dateStr, new DateTimeZone('UTC')); - $d->setTimezone(new DateTimeZone(common_timezone())); return $d->format('c'); } } -- 2.39.5