[chronojump] restTime sortable (minutes and seconds always with two digits)
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] restTime sortable (minutes and seconds always with two digits)
- Date: Mon, 14 Nov 2016 00:22:17 +0000 (UTC)
commit 4dce0684c344cc8db9649b4124363b4fbd2dc7d2
Author: Xavier de Blas <xaviblas gmail com>
Date: Sun Nov 13 23:44:52 2016 +0100
restTime sortable (minutes and seconds always with two digits)
src/restTime.cs | 14 ++++++++++++--
1 files changed, 12 insertions(+), 2 deletions(-)
---
diff --git a/src/restTime.cs b/src/restTime.cs
index db4b988..c546e2b 100644
--- a/src/restTime.cs
+++ b/src/restTime.cs
@@ -48,9 +48,19 @@ public class LastTestTime
get {
TimeSpan ts = DateTime.Now.Subtract(time);
if(ts.TotalMinutes >= 60)
- return "+60'";
+ return "+60'"; //TODO: check if this is correctly sorted on treeview persons
- return string.Format("{0}'{1}\"", ts.Minutes, ts.Seconds);
+ //add a 0 if values are <10 to order them correctly on treeview persons
+ int m = ts.Minutes;
+ int s = ts.Seconds;
+ string mStr = m.ToString();
+ string sStr = s.ToString();
+ if(m < 10)
+ mStr = "0" + mStr;
+ if(s < 10)
+ sStr = "0" + sStr;
+
+ return string.Format("{0}'{1}\"", mStr, sStr);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]