From a59f728bdd7b81964a460b96b6c56da0d9dfda01 Mon Sep 17 00:00:00 2001 From: fiaxh Date: Sat, 12 Aug 2017 23:14:50 +0200 Subject: Stream Management --- .../src/module/xep/0082_date_time_profiles.vala | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) (limited to 'xmpp-vala/src/module/xep/0082_date_time_profiles.vala') diff --git a/xmpp-vala/src/module/xep/0082_date_time_profiles.vala b/xmpp-vala/src/module/xep/0082_date_time_profiles.vala index b2ce1077..57c7ec4d 100644 --- a/xmpp-vala/src/module/xep/0082_date_time_profiles.vala +++ b/xmpp-vala/src/module/xep/0082_date_time_profiles.vala @@ -1,13 +1,13 @@ namespace Xmpp.Xep.DateTimeProfiles { - public class Module { - public Regex DATETIME_REGEX; +public class Module { + public Regex DATETIME_REGEX; - public Module() { - DATETIME_REGEX = new Regex("""^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})(\.(\d{3}))?(Z|((\+|\-)(\d{2}):(\d{2})))$"""); - } + public Module() { + DATETIME_REGEX = new Regex("""^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})(\.(\d{3}))?(Z|((\+|\-)(\d{2})(:(\d{2}))?))$"""); + } - public DateTime? parse_string(string time_string) { + public DateTime? parse_string(string time_string) { MatchInfo match_info; if (DATETIME_REGEX.match(time_string, RegexMatchFlags.ANCHORED, out match_info)) { int year = int.parse(match_info.fetch(1)); @@ -33,9 +33,10 @@ namespace Xmpp.Xep.DateTimeProfiles { return null; } - public string to_datetime(DateTime time) { - return time.format("%Y-%m-%dT%H:%M:%SZ"); - } +public string to_datetime(DateTime time) { + return time.to_utc().format("%Y-%m-%dT%H:%M:%SZ"); } -} \ No newline at end of file +} + +} -- cgit v1.2.3-70-g09d2