title: Assign a value to a variable for a limited time only
body: <p>Let's say that there is a boolean variable, initially assigned the value <code>false</code>. Is there a way to say, let this variable be <code>true</code> for the next 5 minutes and then let it be <code>false</code> again?</p>
  
  <p>My current idea is that I could store the variable along with a timestamp, then as soon as the variable is turned to <code>true</code>, the timestamp is set to the current time, then check the variable's value through a method that will return <code>true</code> if the current time and the initial timestamp form a duration of less than 5 minutes and then <code>false</code> if the duration is greater than 5 minutes. I'm thinking about an implicit conversion from <code>Boolean</code> to a <code>RichBoolean</code> that would handle this mechanism through an elegant method name or something.</p>
  
  <p>Is there a more elegant or Scala native way of doing this?</p>