Hi Brice,

you can easily add a nicer syntax yourself:

implicit class ConfigDuration(val c: Config) extends AnyVal {
  def getMillis(path: String): FiniteDuration =
FiniteDuration(config.getDuration(path, MILLISECONDS), MILLISECONDS)
}

We have not done that yet because FiniteDuration lives in
scala-library.jar, Config lives in config.jar and Akka would not be the
first place people look for such a feature. And config.jar cannot provide
it because it is a pure Java library.

Regards,

Roland



On Mon, May 5, 2014 at 1:57 PM, Brice Figureau <[email protected]>wrote:

> Hi,
>
> Akka 2.3 now depends on Config 1.2.0. In Config 1.2
> Config.getMilliseconds is now deprecated in favor of getDuration(key,
> timeUnit).
>
> With akka 2.2 (and prior) I was building FiniteDuration from config
> with:
>
> val backoff = FiniteDuration(config.getMilliseconds("backoff"),
> TimeUnit.MILLISECONDS)
>
> Not very nice, but does its job.
>
> which I changed to:
>
> val backoff = FiniteDuration(config.getDuration("backoff",
> TimeUnit.MILLISECONDS), TimeUnit.MILLISECONDS)
>
> which is worst.
>
> So is there a better way to get a FiniteDuration out of a config time
> entry?
> Thanks!
> --
> Brice Figureau
> My Blog: http://www.masterzen.fr/
>
> --
> >>>>>>>>>>      Read the docs: http://akka.io/docs/
> >>>>>>>>>>      Check the FAQ:
> http://doc.akka.io/docs/akka/current/additional/faq.html
> >>>>>>>>>>      Search the archives:
> https://groups.google.com/group/akka-user
> ---
> You received this message because you are subscribed to the Google Groups
> "Akka User List" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/akka-user.
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Akka Team
Typesafe - The software stack for applications that scale
Blog: letitcrash.com
Twitter: @akkateam

-- 
>>>>>>>>>>      Read the docs: http://akka.io/docs/
>>>>>>>>>>      Check the FAQ: 
>>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html
>>>>>>>>>>      Search the archives: https://groups.google.com/group/akka-user
--- 
You received this message because you are subscribed to the Google Groups "Akka 
User List" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to