#6744: [with patch, positive review] install script stores start time of build
-------------------------------+--------------------------------------------
 Reporter:  schilly            |         Owner:  tbd           
     Type:  enhancement        |        Status:  closed        
 Priority:  trivial            |     Milestone:  sage-4.1.2    
Component:  distribution       |    Resolution:  fixed         
 Keywords:                     |        Author:  Harald Schilly
 Upstream:  N/A                |      Reviewer:  Tim Dumol     
   Merged:  Sage 4.1.2.alpha0  |   Work_issues:                
-------------------------------+--------------------------------------------
Changes (by drkirkby):

  * upstream:  => N/A


Comment:

 Although this is marked as fixed, it should be noted that it makes use of
 a non-portable option to the {{{date}}} command so fails on some systems.
 See

 http://www.opengroup.org/onlinepubs/009695399/utilities/date.html

 for a list of portable options.

 Since the file created is not actually used by anything it's not a big
 problem, but if anyone tried using it on a Unix system, it would likely
 fail. A better method is:

 {{{
 # Compute seconds since the Epoch.

 # Call 'date'. Note that
 # %Y = year including century
 # %j = day number (1-365)
 # %H = hour (0-23)
 # %M = minute (0-59)
 # %S = seconds (0-59)

 if type env >/dev/null 2>&1 ; then
     set -- `env LC_ALL=C LC_TIME=C LANG=C date -u '+%Y %j %H %M %S'`
 else
     set -- `date -u '+%Y %j %H %M %S'`
 fi

 # $1 = year including century
 # $2 = day number (1-365)
 # $3 = hour (0-23)
 # $4 = minute (0-59)
 # $5 = seconds (0-59)

 if [ $? -ne 0 ] || [ $# -lt 5 ] ; then
   TIME="Error computing seconds since the Epoch"
 fi

 DAYS=`expr 365 \* \( $1 - 1970 \) + \( $1 - 1969 \) / 4 + $2 - 1`
 TIME=`expr $5 + 60 \* \( $4 + 60 \* \( $3 + 24 \* $DAYS \) \)`
 echo $TIME
 }}}

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/6744#comment:5>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica, 
and MATLAB

-- 
You received this message because you are subscribed to the Google Groups 
"sage-trac" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sage-trac?hl=en.

Reply via email to