Look harder for gnu date, use if available.

Signed-off-by: Bryan Larsen <[EMAIL PROTECTED]>
---

 cg-Xlib |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/cg-Xlib b/cg-Xlib
--- a/cg-Xlib
+++ b/cg-Xlib
@@ -70,7 +70,7 @@ showdate () {
        secs=$(($secs + $tzhours * 3600 + $tzmins * 60))
        [ "$format" ] || format="+%a, %d %b %Y %H:%M:%S $2"
        if [ "$has_gnudate" ]; then
-               LANG=C date -ud "1970-01-01 UTC + $secs sec" "$format"
+               LANG=C ${has_gnudate} -ud "1970-01-01 UTC + $secs sec" "$format"
        else
                LANG=C date -u -r $secs "$format"
        fi
@@ -241,4 +241,12 @@ for stat in "$(which gnustat)" "$(which 
     fi
 done
 
-has_gnudate=$(date -Rud "1970-01-01 UTC" 2>/dev/null)
+has_gnudate=
+for date in "$(which gnudate)" "$(which gdate)" "$(which date)" ; do
+    if ( [ $date ] && $date -Rud  "1970-01-01 UTC" 2> /dev/null >&2 ) ; then
+       has_gnudate=$date
+       break
+    fi
+done
+
+
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to