ticks must be between datetime.minvalue.ticks and datetime.maxvalue.ticks
I'm getting this error whilst fetching datetime value in open rails (an open src train simulator). I saw the fetching method in another lib of same exe and tried to use it in the lib that I was modifying according to me but it gives the error "ticks must be between datetime.minvalue.ticks and datetime.maxvalue.ticks" whilst the same piece of code works in the other lib.
13 Replies
what is ActualDepart in this context? seconds since 1970?
actual depart is train object's actual depart time from the set depart time
yes, but what is it measured in?
int it says
and if I log this values it shows "10000000"
but what is the unit?
no unit
should be seconds ig
bc other values like depart time are in seconds
since you want to convert it to a datetime, you need to know what it is counting from. 10000000 seconds since when?
it should be since today's date and 00:00:00 time bc set depart and arrival values are from start of the day
there is only 86400 seconds in a day
yeah exactly
it should not show 1000000 smth
and else it's giving that ticks error
ts
if it's seconds, you can do
new DateTime().AddSeconds(tttrain.PreviousStop.ActualDepart)
or new DateTime(TimeSpan.TicksPerSecond * tttrain.PreviousStop.ActualDepart)
would have the same effect