[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Help-bash] set time
From: |
Bob Proulx |
Subject: |
Re: [Help-bash] set time |
Date: |
Thu, 13 Sep 2012 13:42:44 -0600 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
Hello Max,
Max wrote:
> Is there any *direct* command to shift time in bash (using date or
> another, preferably not too unpopular, console binary)?
You have confused us! Several of us have been wondering what you mean
when you say "command to shift time".
> Say, it's 09:00 now and the command makes it 11:30 *without* me
> having specified "11:30" but only provided the command the 2h30m
> interval.
When you say "the command makes it 11:30" what do you mean?
* Do you mean set the system clock?
* Or do you mean calculate the time?
* Or do you mean run some other command which will think it is running
at a different time?
Please help us help you by saying what it is that you are asking.
> Note that any "indirect" methods may need complicated ways to keep
> track of the milliseconds lost while running them. It even took
> around one second in some virtual machine guest systems. So I'm
> hoping bash etc. happen to have the magic needed to do the job for
> me.
Please say a few more words about what you are asking.
For example when I read "shift time" I immediately thought of
libfaketime which does this dynamically to create an environment with
a different time. Here is reference:
http://www.code-wizards.com/projects/libfaketime/index.html
Some simple examples:
LD_PRELOAD=./libfaketime.so.1 FAKETIME_FMT=%s FAKETIME="`date +%s -d'1 year
ago'`" date
LD_PRELOAD=./libfaketime.so.1 FAKETIME_FMT=%s FAKETIME="`stat -c %Y
somefile`" date
LD_PRELOAD=./libfaketime.so.1 FAKETIME_FMT=%c FAKETIME="`date`" date
Bob