functions: fix date calculations 1.10
author"Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Fri Apr 08 00:02:44 2011 +0200 (2011-04-08)
branch1.10
changeset 239933bcab814b8f
parent 2398 9bafe9c8f0b3
child 2400 2b19fff44d87
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>
(transplanted from bb6e2df2427f3db871721c96ca3226cfa24204bc)
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 @@ -235,7 +235,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