How do i catch a TIME variable overflow?

kenyokenyo Member Posts: 40
Hi, so i use
RemainingTime := 000000T + ROUND((ProcessingDuration / NoOfProgressed ) * ( NoOfRecs - NoOfProgressed ),1)

in my ProcessBar to roughly calculate the remaining time. This can give my an overflow issue during debugging because the max value i believe is 23:59:59.999?
is there a way to catch that error without casting the ProcessingDuration to an int first and calculating the time in an integer?

(obviously the same goes for the ProcessingDuration)

Answers

  • KishormKishorm Member Posts: 921
    edited 2020-02-21
    No you can't and you really shouldn't be using a Time variable for this. Instead use a Duration variable, you can find more info on this here...

    https://docs.microsoft.com/en-us/dynamics-nav/duration-data-type
  • kenyokenyo Member Posts: 40
    edited 2020-02-27
    First off thanks for the answer. The reason i didn't do it is of the presentation. the duration output would be something like "124 days 4 hours 30 minutes 1 second 114 milliseconds" ... would i have to parse and reformat this manually?

    EDIT: i found a solution which works for me , i can catch the error by first checking the remaining time in a duration variable , then if its >= 86400000 displaying that , and if not i will convert it to time.
Sign In or Register to comment.