bb date

Chey chey.smith at gmail.com
Fri Sep 8 14:26:06 UTC 2006


Thank walter. You have been very informative. I look into possibly
expanding the bb date as mentioned.

Chey


On 9/8/06, walter harms <wharms at bfs.de> wrote:
> hi Chey,
> no problem with gnu-date compatibility.
> the problem is 'where to stop' ?
> You can not assume that bb will harbour a parser like date. So date
> should support only the most simple format like the  [MMDDhhmm[[CC]YY][.ss]]
> additional formats like ISO 8601 whatever should supported with -D even
> when it is a bb expansion.
>
> rationale: bb is intended for embedded systems were this is used in scripting,
> and in that case you know the time format in advance. setting the time by hand
> should be no surprise therefore the std. format is ok.
>
> i posted a patch for gnu-date to add -D <hint> perhaps you can pick it up and
> expand it for setting also. gnu-date may also learn from bb-date.
>
> re,
>  walter
>
>
> Chey wrote:
> > The -D switch does what it's supposed to there is no doubt about that.
> > But the GNU date command doesn't like that switch at all.
> >
> > I was hoping it would be possible to add another date format that the
> > BB's date command would accept as a valid date for setting the date
> > with 'date -s'. Possibly one of the following:
> >
> > 2006-09-08 08:09:10 - fairly standard format also accepted by GNU date
> > (ISO 8601 i think)
> > Fri, 08 Sep 2006 08:11:25 -0400 - RFC 2822 date format accepted by GNU
> > date as well
> > 09/08/2006 08:13:12 - another format accepted by GNU date
> >
> > The first one is probably the best bet and fairly easy to implement. I
> > don't see this as a bug but a feature request and will not press it.
> > If others think it's a good idea then great maybe someone can
> > implement it. If not...like i said i won't press it :) I know most
> > people are busy doing other things.
> >
> > Thanks all,
> > Chey
> >
> >
> > On 9/8/06, walter harms <wharms at bfs.de> wrote:
> >> Hi chey,
> >> i had the same problem some time ago (with -d <datum> and format was not
> >> supported with bb). Since the gnu-date parser is rather large, i added the
> >> -D switch as hint.
> >>
> >> perhaps you can change the code to use the -D switch for interpreting the
> >> -s String. that would be a BB extension but i see that it would be helpful.
> >>
> >> re,
> >>  wh
> >>
> >>
> >> Chey wrote:
> >>> By "portability" setting the date I mean using the same command and
> >>> date format to set the date wether it be using BB's date command or
> >>> the using the date command packaged with coreutils. For example, the
> >>> following two commands work with busybox's date command but do not
> >>> work on my Debian system which has a default coreutils package
> >>> installed.
> >>>
> >>> devbox:/# date -s `date +%m%d%H%M%Y.%S`
> >>> date: invalid date `090719502006.56'
> >>> devbox:/# date -s `date +%Y.%m.%d-%H:%M:%S`
> >>> date: invalid date `2006.09.07-19:51:14'
> >>>
> >>> It seems that the only two formats that the BB date command supports
> >>> are the two formats above which do not work with Debian and probably
> >>> don't work with other systems. The second format above seems to be
> >>> custom to BB.
> >>>
> >>> To sum things up, I'm looking for the BB date command to accept more
> >>> (at least one) standard date format when setting the date.
> >>>
> >>> If BB supports another format and I missed this in the code please let me know.
> >>>
> >>> Thanks,
> >>> Chey
> >>>
> >>>
> >>> On 9/7/06, Rich Felker <dalias at aerifal.cx> wrote:
> >>>> On Thu, Sep 07, 2006 at 02:50:10PM -0400, Chey wrote:
> >>>>> BB's date command seems to only accept two formats for setting the
> >>>>> date. Are these to formats subject to bb's date command only or should
> >>>>> those two formats work on other distros as well?
> >>>>>
> >>>>> I'm asking because I cannot set the date with bb's date command and
> >>>>> use that same command to set the date on my Debian box.
> >>>>>
> >>>>> I'm having trouble creating a portable script to set the date because of this.
> >>>> There's no such thing as "portably setting the date" since POSIX does
> >>>> not specify that the date can be changed at all. :) However in terms
> >>>> of working on most/all legacy implementations and BB, I believe one of
> >>>> the formats works well. Look at the comments in the source; I seem to
> >>>> remember them being helpful.
> >>>>
> >>>> Rich
> >>>>
> >>>> _______________________________________________
> >>>> busybox mailing list
> >>>> busybox at busybox.net
> >>>> http://busybox.net/cgi-bin/mailman/listinfo/busybox
> >>>>
> >>> _______________________________________________
> >>> busybox mailing list
> >>> busybox at busybox.net
> >>> http://busybox.net/cgi-bin/mailman/listinfo/busybox
> >>>
> >>>
> >>>
> > _______________________________________________
> > busybox mailing list
> > busybox at busybox.net
> > http://busybox.net/cgi-bin/mailman/listinfo/busybox
> >
> >
> >
> _______________________________________________
> busybox mailing list
> busybox at busybox.net
> http://busybox.net/cgi-bin/mailman/listinfo/busybox
>



More information about the busybox mailing list