TIMA: 15 min Time Reporting only tracked as 5 min

I recently worked on an issue where a customer was using TIMA and trying to record an appointment with a 15 min duration but it would end up getting tracked as 5 mins. After doing some testing on the machine I realized that the behavior was that the number 1 was dropped if it was the leading character of the duration. So, if the duration was 1 min nothing happened. If it was 2 through 9 it was tracked correctly. If it was 10 through 19 it was tracked as 0 through 9. And 20 through 99 was tracked correctly. Two hours (120 mins) was tracked as 20 mins.

After debugging for quite a while I discovered that the problem was that the Windows regional settings on the machine had an incorrect entry defined for the Positive Sign for numbers.  Normally the Positive Sign is "+" and the Negative Sign is "-".  For this user the Positive Sign had been set to "1".  So, whenever CultureInformation was applied to numeric operations any leading 1 would be dropped because it was interpreted as the character to represent positive values (i.e. +). This issue had nothing directly to do with the Duet code - Duet was just using the .NET framework to convert an Integer to a String and getting back the wrong value.

The following registry key contains the value used for the positive sign and this issue can be easily reproduced on any machine by changing the value to a 1.

HKEY_CURRENT_USER\Control Panel\International\sPositiveSign

The following article discusses another issue that can happen if this sPositiveSign value is not valid and also discusses how to reset the values.

KB942460 System.FormatException occurs when attempting to convert a numeric string to a numeric data type

Resolution

Once the sPositiveSign registry value was reset to the correct value of "+" everything worked again.