Handle zero time diff better
This commit is contained in:
parent
480fcdc8b9
commit
5f692d215a
@ -71,6 +71,7 @@ public class TimeDiffUtil
|
|||||||
if (!matcherFull.matches()) throw new NullPointerException("Invalid time diff format.");
|
if (!matcherFull.matches()) throw new NullPointerException("Invalid time diff format.");
|
||||||
|
|
||||||
LinkedHashMap<TimeUnit, Long> ret = new LinkedHashMap<TimeUnit, Long>();
|
LinkedHashMap<TimeUnit, Long> ret = new LinkedHashMap<TimeUnit, Long>();
|
||||||
|
if (formated.equals("0")) return ret;
|
||||||
|
|
||||||
Matcher matcherPart = patternPart.matcher(formated);
|
Matcher matcherPart = patternPart.matcher(formated);
|
||||||
while (matcherPart.find())
|
while (matcherPart.find())
|
||||||
@ -167,6 +168,11 @@ public class TimeDiffUtil
|
|||||||
String comma = String.format(commaFormat, Txt.parse(color));
|
String comma = String.format(commaFormat, Txt.parse(color));
|
||||||
String and = String.format(andFormat, Txt.parse(color));
|
String and = String.format(andFormat, Txt.parse(color));
|
||||||
|
|
||||||
|
if (unitcounts.isEmpty())
|
||||||
|
{
|
||||||
|
return formated(TimeUnit.SECOND, 0, entryFormat);
|
||||||
|
}
|
||||||
|
|
||||||
List<String> parts = new ArrayList<String>();
|
List<String> parts = new ArrayList<String>();
|
||||||
for (Entry<TimeUnit, Long> entry : unitcounts.entrySet())
|
for (Entry<TimeUnit, Long> entry : unitcounts.entrySet())
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user