[Nix-dev] Set date/time manually

Bjørn Forsman bjorn.forsman at gmail.com
Wed Jun 15 17:17:00 CEST 2016


On 15 June 2016 at 16:36, Eike <eike at eknet.org> wrote:
>
> sorry, I meant to write `sudo date +%Y%m%d -s "20180210`.
>
> Eike <eike at eknet.org> writes:
>
>> Hello NixOS experts,
>>
>> I want to test applications if they would work some time in the future
>> and so I thought to change the date using timedatectl. But it says that
>> it is not possible to use it on NixOS. The date command also doesn't
>> seem to work: the date/time is not changed after doing for example `sudo
>> date +%Y%m%d "20180210"`.
>>
>> How can I temporarily set the system time some value?

Your command works for me. ("date" returns the new date.) But for
testing purposes, I'd have a look at faketime instead: nix-env -iA
nixos.libfaketime.


More information about the nix-dev mailing list