functions: fix date calculations
author"Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Fri Apr 08 00:02:44 2011 +0200 (2011-04-08)
changeset 2383bb6e2df2427f
parent 2382 cbd07f3dd6e3
child 2384 5f260bb27b35
functions: fix date calculations

In case date(1) does not support nanosecond resolution, it does
not interpret '%N', and leave it as-is. So we have to remove it.

Note that some versions replaces '%N' with 'N', so we have to
take this into account as well.

Reported-by: Kyle Grieb <grieb.kyle@gmail.com>
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
scripts/functions
     1.1 --- a/scripts/functions	Thu Apr 07 11:52:23 2011 +0200
     1.2 +++ b/scripts/functions	Fri Apr 08 00:02:44 2011 +0200
     1.3 @@ -250,7 +250,7 @@
     1.4  # to the highest entire second
     1.5  # Usage: CT_DoDate <fmt>
     1.6  CT_DoDate() {
     1.7 -    date "$1" |sed -r -e 's/N$/000000000/;'
     1.8 +    date "$1" |sed -r -e 's/%?N$/000000000/;'
     1.9  }
    1.10  
    1.11  CT_STEP_COUNT=1