From 92b9c195e5724e1bee7a85217332a72dc96309e8 Mon Sep 17 00:00:00 2001 From: MikalaiR Date: Mon, 20 Apr 2015 11:47:42 +0000 Subject: SkypeWeb: Call duration format. git-svn-id: http://svn.miranda-ng.org/main/trunk@12964 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/SkypeWeb/src/skype_history_sync.cpp | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'protocols/SkypeWeb/src/skype_history_sync.cpp') diff --git a/protocols/SkypeWeb/src/skype_history_sync.cpp b/protocols/SkypeWeb/src/skype_history_sync.cpp index ed75061658..ff0e6f9a0d 100644 --- a/protocols/SkypeWeb/src/skype_history_sync.cpp +++ b/protocols/SkypeWeb/src/skype_history_sync.cpp @@ -126,11 +126,21 @@ void CSkypeProto::OnGetServerHistory(const NETLIBHTTPREQUEST *response) text.Append(Translate("Call started")); else if (iType == 0) { + CMStringA chours = "", cmins = "", csec = ""; int hours=0, mins=0, sec=0; - hours = iDuration != NULL ? iDuration / 3600 : 0; - mins = iDuration != NULL ? iDuration / 60 : 0; - sec = iDuration != NULL ? iDuration % 60 : 0; - text.AppendFormat("%s\n%s: %d:%d:%d", Translate("Call ended"), Translate("Duration"), hours, mins, sec); + if (iDuration != NULL) + { + hours = iDuration / 3600; + mins = iDuration / 60; + sec = iDuration % 60; + } + else + hours=mins=sec=0; + + if (hours < 10) chours.AppendFormat("0%d", hours); else chours.AppendFormat("%d", hours); + if (mins < 10) cmins.AppendFormat("0%d", mins); else cmins.AppendFormat("%d", mins); + if (sec < 10) csec.AppendFormat("0%d", sec); else csec.AppendFormat("%d", sec); + text.AppendFormat("%s\n%s: %s:%s:%s", Translate("Call ended"), Translate("Duration"), chours, cmins, csec); } AddMessageToDb(hContact, timestamp, flags, clientMsgId, text.GetBuffer()); } -- cgit v1.2.3