madhuneal / ppss

Automatically exported from code.google.com/p/ppss
0 stars 0 forks source link

date +%s fails on my Solaris machine, so expr complains a lot, among other things #25

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
You can simulate the error by assuming that `date +%s` returns '%s' and
seeing how much expr complains.  If you could test the output of the date
command at startup and then use perl -e 'print time' when date fails, that
would be great.

Fractional sleeps, like sleep 0.1, also fail on my machine, because it can
only sleep integral numbers of seconds.  Here you could substitute perl -e
'select(undef, undef, undef, 0.1)' if you wish.

Of course, perl would have to exist on the target machines, so you might
have to check for that, too.

Thanks,
Jim Walker

Original issue reported on code.google.com by walk...@walkerj.de on 23 Mar 2010 at 7:27

GoogleCodeExporter commented 9 years ago
When I have a working Solaris VM, I check it out. It worked the last time I 
checked on solaris 10, but that was 
some time ago. 

Original comment by Louwrentius on 25 Mar 2010 at 1:18

GoogleCodeExporter commented 9 years ago
Ok.  Here's a diff of my fix:
72c72,73
< START_PPSS="$(date +%s)"
---
> #START_PPSS="$(date +%s)"
> START_PPSS="$(perl -e 'print time')"
1010c1011,1012
<             sleep 0.1
---
>             #sleep 0.1
>           perl -e "select(undef, undef, undef, 0.1)"
1178c1180,1181
<     sleep "0.$NUMBER"
---
>     #sleep "0.$NUMBER"
>     perl -e "select(undef, undef, undef, 0.$NUMBER)"
1543c1546,1547
<    STOP_PPSS="$(date +%s)"
---
>    #STOP_PPSS="$(date +%s)"
>    STOP_PPSS="$(perl -e 'print time')"
1720c1724,1725
<         BEFORE="$(date +%s)"
---
>         #BEFORE="$(date +%s)"
>       BEFORE="$(perl -e 'print time')"
1732c1737,1738
<         AFTER="$(date +%s)"
---
>         #AFTER="$(date +%s)"
>       AFTER="$(perl -e 'print time')"
You could probably be a bit more clever than I by assigning the date- and 
fractional-
sleep- commands to be used to variables at startup, after checking for perl.

Original comment by walk...@walkerj.de on 25 Mar 2010 at 11:34

GoogleCodeExporter commented 9 years ago
Thanx for the patch, but I don't want to depend on Perl so I found another 
solution that does the same thing. 

Original comment by Louwrentius on 26 Mar 2010 at 10:54