From c029e5aac8ceb7fca6a2b4e73790c349b36e42a2 Mon Sep 17 00:00:00 2001 From: Rodrigo Braz Monteiro Date: Mon, 10 Nov 2008 01:57:33 +0000 Subject: [PATCH] Tweaking time class. Originally committed to SVN as r2445. --- athenasub/src/athenatime.cpp | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/athenasub/src/athenatime.cpp b/athenasub/src/athenatime.cpp index 6b59340af..642c4cf48 100644 --- a/athenasub/src/athenatime.cpp +++ b/athenasub/src/athenatime.cpp @@ -136,17 +136,36 @@ void Time::ParseString(const String &data) size_t len = data.Length(); size_t curIndex = 0; char cur = 0; + bool gotDecimal = false; for (size_t i=0;i 3) { + + } + } + } values.at(curIndex++) = value; } } @@ -154,8 +173,9 @@ void Time::ParseString(const String &data) // Turn into milliseconds size_t mult[] = { 0, 1, 1000, 60000, 3600000 }; size_t accum = 0; + size_t adjust = gotDecimal ? 0 : 1; for (int i=(int)curIndex;--i>=0;) { - accum += values[i] * mult[curIndex-i]; + accum += values[i] * mult[curIndex-i+adjust]; } // Set