Ah, your question was ambiguous on that point; you'd add the attoseconds component back (appropriately scaled) for the fractional component, of course.
extension Duration {
var inMilliseconds: Double {
Double((self * 1000).components.seconds)
Edit: no, that was not correct, this one is better:
extension Duration {
var inMilliseconds: Double {
let v = components
return Double(v.seconds) * 1000 + Double(v.attoseconds) * 1e-15
}
}
Gee, I've just corrected another mistake (was multiplying integer seconds - which may overflow) Shouldn't this be in the standard library or was it deliberately not included?