Re: invalid options with date

2016-09-22 Thread ITwrx.org
On 09/22/2016 06:14 PM, Jeremy Chadwick wrote:
> The reason date -h etc. doesn't work is because, as described, your
> Busybox was built with support for such disabled.  You will need to talk
> to whoever maintains your Busybox package/install, or if that's you,
> then you need to consider tweaking the config further for such.
>
> I have no problem with date on Busybox 1.25.0 with regards to most of
> your script's date syntaxes, as well as others shown in the syntax
> usage.
>
> First, your TODAY:
>
> root@gw:/tmp/home/root# date +"%Y-%m-%d"
> 2016-09-22
>
> Now your tmpDays, but I'll use a different date than the above, to show
> it's working:
>
> root@gw:/tmp/home/root# date --date="2002-12-20"
> Fri Dec 20 00:00:00 PST 2002
> root@gw:/tmp/home/root# date --date="2002-12-20" +%s
> 1040371200
>
> Verifying that UNIX timestamp correlates with the correct date:
>
> root@gw:/tmp/home/root# perl -e 'print scalar localtime(1040371200), "\n";'
> Fri Dec 20 00:00:00 2002
>
> In tmpDays, you use something called $birthdate, which uses variables
> that aren't defined (in the code you showed), so I can't tell if they're
> 2-digit years, 4-digit years, variable-width month values, or what, thus
> I cannot test that.
>
> The only two compile-time date tweaking options I see are
> CONFIG_FEATURE_DATE_ISOFMT and CONFIG_FEATURE_DATE_COMPAT, but I don't
> believe these are relevant:
>
>  33 //config:config FEATURE_DATE_ISOFMT
>  34 //config:   bool "Enable ISO date format output (-I)"
>  35 //config:   default y
>  36 //config:   depends on DATE
>  37 //config:   help
>  38 //config: Enable option (-I) to output an ISO-8601 compliant
>  39 //config: date/time string.
>  40 //config:
>
>  50 //config:config FEATURE_DATE_COMPAT
>  51 //config:   bool "Support weird 'date MMDDhhmm[[YY]YY][.ss]' format"
>  52 //config:   default y
>  53 //config:   depends on DATE
>  54 //config:   help
>  55 //config: System time can be set by 'date -s DATE' and simply 'date 
> DATE',
>  56 //config: but formats of DATE string are different. 'date DATE' 
> accepts
>  57 //config: a rather weird MMDDhhmm[[YY]YY][.ss] format with completely
>  58 //config: unnatural placement of year between minutes and seconds.
>  59 //config: date -s (and other commands like touch -d) use more sensible
>  60 //config: formats (for one, ISO format -MM-DD hh:mm:ss.ss).
>  61 //config:
>  62 //config: With this option off, 'date DATE' is 'date -s DATE' support
>  63 //config: the same format. With it on, 'date DATE' additionally 
> supports
>  64 //config: MMDDhhmm[[YY]YY][.ss] format.
>
> That leaves reviewing changes between Busybox 1.24.2 and 1.25.0, so
> let's look at that, specifically looking for tags of 1_24_2 and 1_25_0:
>
> 1_25_stable: https://git.busybox.net/busybox/log/?h=1_25_stable
> 1_24_stable: https://git.busybox.net/busybox/log/?h=1_24_stable
>
> I see nothing in the 1_24_stable commit history, after 1_24_2, that
> indicates fixes/tweaks for date, so I don't have an immediate
> explanation.
>
> That said: is there a reason you're omitting depiction of the actual
> problem?  You've given descriptions, but aren't pasting full terminal
> output.  It would help because then one could reverse-engineer some of
> the messages shown back to code and see if the cause could be
> determined.
>
i understand you to be saying that "-d" and "--date" are both supported
in the official busybox, so i'll either try a different busybox app or
contact the developer of this particular busybox android app. thanks for
all the info. above and beyond the call of duty.


___
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox


Re: invalid options with date

2016-09-22 Thread Jeremy Chadwick
The reason date -h etc. doesn't work is because, as described, your
Busybox was built with support for such disabled.  You will need to talk
to whoever maintains your Busybox package/install, or if that's you,
then you need to consider tweaking the config further for such.

I have no problem with date on Busybox 1.25.0 with regards to most of
your script's date syntaxes, as well as others shown in the syntax
usage.

First, your TODAY:

root@gw:/tmp/home/root# date +"%Y-%m-%d"
2016-09-22

Now your tmpDays, but I'll use a different date than the above, to show
it's working:

root@gw:/tmp/home/root# date --date="2002-12-20"
Fri Dec 20 00:00:00 PST 2002
root@gw:/tmp/home/root# date --date="2002-12-20" +%s
1040371200

Verifying that UNIX timestamp correlates with the correct date:

root@gw:/tmp/home/root# perl -e 'print scalar localtime(1040371200), "\n";'
Fri Dec 20 00:00:00 2002

In tmpDays, you use something called $birthdate, which uses variables
that aren't defined (in the code you showed), so I can't tell if they're
2-digit years, 4-digit years, variable-width month values, or what, thus
I cannot test that.

The only two compile-time date tweaking options I see are
CONFIG_FEATURE_DATE_ISOFMT and CONFIG_FEATURE_DATE_COMPAT, but I don't
believe these are relevant:

 33 //config:config FEATURE_DATE_ISOFMT
 34 //config:   bool "Enable ISO date format output (-I)"
 35 //config:   default y
 36 //config:   depends on DATE
 37 //config:   help
 38 //config: Enable option (-I) to output an ISO-8601 compliant
 39 //config: date/time string.
 40 //config:

 50 //config:config FEATURE_DATE_COMPAT
 51 //config:   bool "Support weird 'date MMDDhhmm[[YY]YY][.ss]' format"
 52 //config:   default y
 53 //config:   depends on DATE
 54 //config:   help
 55 //config: System time can be set by 'date -s DATE' and simply 'date 
DATE',
 56 //config: but formats of DATE string are different. 'date DATE' accepts
 57 //config: a rather weird MMDDhhmm[[YY]YY][.ss] format with completely
 58 //config: unnatural placement of year between minutes and seconds.
 59 //config: date -s (and other commands like touch -d) use more sensible
 60 //config: formats (for one, ISO format -MM-DD hh:mm:ss.ss).
 61 //config:
 62 //config: With this option off, 'date DATE' is 'date -s DATE' support
 63 //config: the same format. With it on, 'date DATE' additionally supports
 64 //config: MMDDhhmm[[YY]YY][.ss] format.

That leaves reviewing changes between Busybox 1.24.2 and 1.25.0, so
let's look at that, specifically looking for tags of 1_24_2 and 1_25_0:

1_25_stable: https://git.busybox.net/busybox/log/?h=1_25_stable
1_24_stable: https://git.busybox.net/busybox/log/?h=1_24_stable

I see nothing in the 1_24_stable commit history, after 1_24_2, that
indicates fixes/tweaks for date, so I don't have an immediate
explanation.

That said: is there a reason you're omitting depiction of the actual
problem?  You've given descriptions, but aren't pasting full terminal
output.  It would help because then one could reverse-engineer some of
the messages shown back to code and see if the cause could be
determined.

-- 
| Jeremy Chadwick   j...@koitsu.org |
| UNIX Systems Administratorhttp://jdc.koitsu.org/ |
| Making life hard for others since 1977. PGP 4BD6C0CB |

On Thu, Sep 22, 2016 at 05:47:43PM -0500, ITwrx.org wrote:
> On 09/22/2016 05:08 PM, Jeremy Chadwick wrote:
> > Be sure to note that this is for 1.25.0; 1.24.2 may be different.
> > I got this by using "date -h", but whether or not usage syntax is
> > enabled depends on how your Busybox was built/configured.
> >
> > I believe the TIME format section should answer your question (you need
> > to include hours and minutes, so try 00:00), ditto with -d/--date.
> >
> >
> > BusyBox v1.25.0 (2016-09-09 15:02:42 ICT) multi-call binary.
> >
> > Usage: date [OPTIONS] [+FMT] [TIME]
> >
> > Display time (using +FMT), or set time
> >
> > [-s,--set] TIME Set time to TIME
> > -u,--utcWork in UTC (don't convert to local time)
> > -R,--rfc-2822   Output RFC-2822 compliant date string
> > -I[SPEC]Output ISO-8601 compliant date string
> > SPEC='date' (default) for date only,
> > 'hours', 'minutes', or 'seconds' for date and
> > time to the indicated precision
> > -r,--reference FILE Display last modification time of FILE
> > -d,--date TIME  Display TIME, not 'now'
> > -D FMT  Use FMT for -d TIME conversion
> >
> > Recognized TIME formats:
> > hh:mm[:ss]
> > [.]MM.DD-hh:mm[:ss]
> > -MM-DD hh:mm[:ss]
> > [YY]YY]MM]DD]hh]mm[.ss]
> > 'date TIME' form accepts MMDDhhmm[[YY]YY][.ss] instead
> >
>  thanks for your help. "date -h" doesn't work on mine, nor "man date" or
> "date --help".  am i understanding you corre

Re: invalid options with date

2016-09-22 Thread ITwrx.org
On 09/22/2016 05:08 PM, Jeremy Chadwick wrote:
> Be sure to note that this is for 1.25.0; 1.24.2 may be different.
> I got this by using "date -h", but whether or not usage syntax is
> enabled depends on how your Busybox was built/configured.
>
> I believe the TIME format section should answer your question (you need
> to include hours and minutes, so try 00:00), ditto with -d/--date.
>
>
> BusyBox v1.25.0 (2016-09-09 15:02:42 ICT) multi-call binary.
>
> Usage: date [OPTIONS] [+FMT] [TIME]
>
> Display time (using +FMT), or set time
>
> [-s,--set] TIME Set time to TIME
> -u,--utcWork in UTC (don't convert to local time)
> -R,--rfc-2822   Output RFC-2822 compliant date string
> -I[SPEC]Output ISO-8601 compliant date string
> SPEC='date' (default) for date only,
> 'hours', 'minutes', or 'seconds' for date and
> time to the indicated precision
> -r,--reference FILE Display last modification time of FILE
> -d,--date TIME  Display TIME, not 'now'
> -D FMT  Use FMT for -d TIME conversion
>
> Recognized TIME formats:
> hh:mm[:ss]
> [.]MM.DD-hh:mm[:ss]
> -MM-DD hh:mm[:ss]
> [YY]YY]MM]DD]hh]mm[.ss]
> 'date TIME' form accepts MMDDhhmm[[YY]YY][.ss] instead
>
 thanks for your help. "date -h" doesn't work on mine, nor "man date" or
"date --help".  am i understanding you correctly that "-d" and "--date"
are supported
but if you don't give it the time format correctly it reports the error
erroneously by saying that the option itself is not supported when it
really is trying to report that the time format was invalid?



-- 
Information Technology Works
https://ITwrx.org
@ITwrxorg

___
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox


Re: invalid options with date

2016-09-22 Thread Jeremy Chadwick
Be sure to note that this is for 1.25.0; 1.24.2 may be different.
I got this by using "date -h", but whether or not usage syntax is
enabled depends on how your Busybox was built/configured.

I believe the TIME format section should answer your question (you need
to include hours and minutes, so try 00:00), ditto with -d/--date.


BusyBox v1.25.0 (2016-09-09 15:02:42 ICT) multi-call binary.

Usage: date [OPTIONS] [+FMT] [TIME]

Display time (using +FMT), or set time

[-s,--set] TIME Set time to TIME
-u,--utcWork in UTC (don't convert to local time)
-R,--rfc-2822   Output RFC-2822 compliant date string
-I[SPEC]Output ISO-8601 compliant date string
SPEC='date' (default) for date only,
'hours', 'minutes', or 'seconds' for date and
time to the indicated precision
-r,--reference FILE Display last modification time of FILE
-d,--date TIME  Display TIME, not 'now'
-D FMT  Use FMT for -d TIME conversion

Recognized TIME formats:
hh:mm[:ss]
[.]MM.DD-hh:mm[:ss]
-MM-DD hh:mm[:ss]
[YY]YY]MM]DD]hh]mm[.ss]
'date TIME' form accepts MMDDhhmm[[YY]YY][.ss] instead

-- 
| Jeremy Chadwick   j...@koitsu.org |
| UNIX Systems Administratorhttp://jdc.koitsu.org/ |
| Making life hard for others since 1977. PGP 4BD6C0CB |

On Thu, Sep 22, 2016 at 02:36:11PM -0500, ITwrx.org wrote:
> hi,
> 
> i'm trying to run my bash script (that works on my linux boxes) using
> busybox app (ru.meefik.busybox, ver. 1.24.2) on android
> 5.1.1(cyanogenmod 12) and i'm having trouble with date not supporting
> options. first it was "-d" that was causing issues. now busybox
> complains: "date: invalid option -- -"
> 
> the code in question is here:
> 
> TODAY=$(date +"%Y-%m-%d")   
> birthdate=$(($bday_yr$bday_mo$bday_day))   
> tmpDays=$(( ($(date --date="$TODAY" +%s) - $(date --date="$birthdate"
> +%s) )/(60*60*24) ))
> years=$(( $tmpDays / 365))
> 
> so i guess it doesn't like the "--date".
> 
> can anyone tell me how i'm supposed to get years (above) without using
> "-d", "--date", or any other unkown unsupported options? or maybe
> there's an accurate help file somehwere for busyboxe's date? the one i
> found online says "-d" is supported, but evidently that's not correct.
> 
> thanks in advance
> 
> -- 
> Information Technology Works
> https://ITwrx.org
> @ITwrxorg
> 
> ___
> busybox mailing list
> busybox@busybox.net
> http://lists.busybox.net/mailman/listinfo/busybox
___
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox