[RFC v3 4/5] commands: add hwclock

Antony Pavlov antonynpavlov at gmail.com
Thu Jul 24 12:17:00 PDT 2014


On Mon, 21 Jul 2014 19:41:50 +0400
Antony Pavlov <antonynpavlov at gmail.com> wrote:

ping!

> On Mon, 21 Jul 2014 10:11:50 +0200
> Sascha Hauer <s.hauer at pengutronix.de> wrote:
> 
> > On Mon, Jul 21, 2014 at 11:10:25AM +0400, Antony Pavlov wrote:
> > > On Mon, 21 Jul 2014 08:41:06 +0200
> > > Sascha Hauer <s.hauer at pengutronix.de> wrote:
> > > 
> > > > On Sun, Jul 20, 2014 at 09:55:22AM +0400, Antony Pavlov wrote:
> > > > > On Sat, 19 Jul 2014 21:02:22 +0200
> > > > > Holger Schurig <holgerschurig at gmail.com> wrote:
> > > > > 
> > > > > > I'd prefer a more logical format (and that is also in the help).
> > > > > > However, in this case I wouldn't name the command "hwclock", but maybe
> > > > > > "setclock".
> > > > > 
> > > > > hwclock allows to use a logical format!
> > > > > 
> > > > > e.g. here is a quote from hwclock manpage:
> > > > > 
> > > > >      --date=date_string
> > > > >               You  need this option if you specify the --set or --predict functions, otherwise
> > > > >               it is ignored.  It specifies the time to which to set the Hardware Clock, or the
> > > > >               time  for which to predict the Hardware Clock reading.  The value of this option
> > > > >               is an argument to the date(1) program.  For example:
> > > > > 
> > > > >                   hwclock --set --date="2011-08-14 16:45:05"
> > > > 
> > > > Is this format easy enough to parse? If yes, that sounds like a good
> > > > format.
> > > 
> > > So you have no objections on using a logical format :)
> > 
> > No, not at all ;)
> > 
> > > 
> > > I can make a small review on conventional date_string formats so we can discuss most appropriate one.
> > 
> > Nice, thanks.
> > 
> > I think we can always add additional formats using different command
> > line switches, but the better we chose our default format the lesser
> > need we'll have to add additional formats.
> 
> I know about at least two widespread date command realizations used with linux:
> 
>   * coreutils realization;
>   * busybox realization.
> 
> 
> coreutils realization
> =====================
> 
> I have looked inside parse_datetime() from coreutils-8.21/lib/parse-datetime.c.
> 
> It uses yyparse() for date string parsing! The corresponding yacc description
> is inside the lib/parse-datetime.y file. Can I easely steal this code for barebox? I suppose NO!
> 
> 
> busybox realization
> ===================
> 
> Here is parse_datestr() (barebox.git/libbb/time.c) date format list:
> 
> #if ENABLE_FEATURE_DATE_COMPAT 
> /* MMDDhhmm[[CC]YY][.ss] */  ---  weird 'date' format
> #endif
> 
> /* HH:MM[:SS] */
> /* mm.dd-HH:MM[:SS] */
> /* yyyy.mm.dd-HH:MM[:SS] */
> /* yyyy-mm-dd HH:MM[:SS] */
> 
> /* month_name d HH:MM:SS YYYY */ --- I suppose we don't want to mess with mount_name :)
> /* yyyy-mm-dd HH */
> /* yyyy-mm-dd */
> 
> /* MM[.SS] */
> /* HHMM[.SS] */
> /* ddHHMM[.SS] */
> /* mmddHHMM[.SS] */
> /* yymmddHHMM[.SS] */
> /* ccyymmddHHMM[.SS] */ --- this format is used in RFCv3 patchseries.
> 
> -- 
> Best regards,
>   Antony Pavlov


-- 
-- 
Best regards,
  Antony Pavlov



More information about the barebox mailing list