[PATCH] touch: add config option to set microsecond timestamps
Peter D
urmum69 at snopyta.org
Thu Apr 8 10:44:45 UTC 2021
On Thu Apr 8, 2021 at 11:27 AM BST, Xabier Oneca -- xOneca wrote:
> Hi Peter,
>
> So quick for the patch! Nice! :)
>
> > This patch adds a config option which makes touch set timestamps to the
> > current microsecond, instead of the current second.
> >
> > Signed-off-by: Peter D <urmum69 at snopyta.org>
> > ---
> > This patch should be applied on top of Xabier Oneca's patches to add the
> > -a and -m options to busybox
> >
> > coreutils/touch.c | 22 ++++++++++++++++++----
> > 1 file changed, 18 insertions(+), 4 deletions(-)
> >
> > diff --git a/coreutils/touch.c b/coreutils/touch.c
> > index e80720982..ac9e233ad 100644
> > --- a/coreutils/touch.c
> > +++ b/coreutils/touch.c
> > @@ -33,6 +33,13 @@
> > //config: depends on TOUCH
> > //config: help
> > //config: Enable touch to use a reference file or a given date/time argument.
> > +//config:
> > +//config:config FEATURE_TOUCH_MICROSECONDS
> > +//config: bool "Add support for setting microsecond timestamps"
> > +//config: default y
>
> I would make it default 'y' to preserve filesystem timestamps when
> using -a/-m, but maybe it is not so important the sub-second precision
> in touch..?
Looking at Rasmus's feedback, I probably think it would be best to
simply switch to using utimensat(), and have nanosecond precision. I
just wasn't sure at the time if it was a good idea to switch from using
utimes/lutimes.
> Hey! Not so fast! You forgot the curly brackets! ;)
Well, that's embarassing. I really should have checked twice, thanks for
pointing it out.
Peter D.
More information about the busybox
mailing list