[erlang-questions] add a time interval to a timestamp
Loris Fichera
loris.fichera@REDACTED
Tue Mar 15 16:22:09 CET 2011
On 03/15/2011 03:32 PM, Attila Rajmund Nohl wrote:
> Hello!
>
> Unfortunately the calendar:* functions crash on wrong input:
>
> 1> calendar:datetime_to_gregorian_seconds({{2011,2,30},{1,2,3}}).
> ** exception error: no true branch found when evaluating an if expression
> in function calendar:date_to_gregorian_days/3
> in call from calendar:datetime_to_gregorian_seconds/1
>
> So if the input cannot be trusted, there's still some validation to be done.
Ok.
Actually, in my case the input is generated via the erlang:localtime()
function, so I'm sure about its validity.
Loris
More information about the erlang-questions
mailing list