Thread overview | |||||
---|---|---|---|---|---|
|
August 02, 2017 Compare times: file modification time | ||||
---|---|---|---|---|
| ||||
With import std.file:timeLastModified; auto time = timeLastModified(source); I get a SysTime, how to check if it is older than an interval (1 day)? D/Phobos idiomatically? (Currently I am using (Clock.currTime().toUnixTime-time.toUnixTime)< 60*60*24)). Regards mt. |
August 02, 2017 Re: Compare times: file modification time | ||||
---|---|---|---|---|
| ||||
Posted in reply to Martin Tschierschke | On Wednesday, 2 August 2017 at 13:25:25 UTC, Martin Tschierschke wrote:
> I get a SysTime, how to check if it is older than an interval (1 day)?
> D/Phobos idiomatically?
if(Clock.currTime - timeLastModified("aa.d") > 1.days) {
// older
}
|
August 02, 2017 Re: Compare times: file modification time | ||||
---|---|---|---|---|
| ||||
Posted in reply to Adam D. Ruppe | On Wednesday, 2 August 2017 at 13:32:46 UTC, Adam D. Ruppe wrote:
> On Wednesday, 2 August 2017 at 13:25:25 UTC, Martin Tschierschke wrote:
>> I get a SysTime, how to check if it is older than an interval (1 day)?
>> D/Phobos idiomatically?
>
> if(Clock.currTime - timeLastModified("aa.d") > 1.days) {
> // older
> }
Thank you Adam. So simple!
|
Copyright © 1999-2021 by the D Language Foundation