Sunday, October 14, 2012

Dealing with time intervals

Sometimes in a configuration file you want to express something should happen periodically or after a delay. The problem is that Erlang like most languages wants to see an integer number of milliseconds, while I want to write something that will make sense. If I see 5400000  in a config file I have no idea what that means. On the other hand if I see {90, minute} then it is very clear that  this is a time value.

Here is a brief function that will let you specify time as seconds, minutes, hours or days.


No comments:

Post a Comment