Home My Page Projects Code Snippets Project Openings SML/NJ
Summary Activity Forums Tracker Lists Tasks Docs Surveys News SCM Files

SCM Repository

[smlnj] Diff of /sml/branches/primop-branch/src/system/Basis/Implementation/Posix/posix-procenv.sml
ViewVC logotype

Diff of /sml/branches/primop-branch/src/system/Basis/Implementation/Posix/posix-procenv.sml

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1470, Mon Mar 29 22:45:55 2004 UTC revision 1471, Mon Mar 29 22:45:55 2004 UTC
# Line 81  Line 81 
81    
82      val ticksPerSec = IntImp.toLarge (SysWord.toIntX (sysconf "CLK_TCK"))      val ticksPerSec = IntImp.toLarge (SysWord.toIntX (sysconf "CLK_TCK"))
83    
     (* The following code assumes that 1 microsecond is equal or shorter  
      * than the the resolution of Time.time values.  The code is most  
      * efficient if it is equal.... *)  
84      val ticksToTime =      val ticksToTime =
85          case IntInfImp.quotRem (1000000, ticksPerSec) of          case IntInfImp.quotRem (TimeImp.fractionsPerSecond, ticksPerSec) of
86              (factor, 0) =>              (factor, 0) =>
87                (fn ticks => Time.fromMicroseconds                (fn ticks => Time.fromFractions
88                                 (factor * Int32Imp.toLarge ticks))                                 (factor * Int32Imp.toLarge ticks))
89            | _ => (* 1000000 not a multiple of ticksPerSec, so we            | _ =>
                   * have to do it the hard way... *)  
90                (fn ticks =>                (fn ticks =>
91                    Time.fromMicroseconds                    Time.fromFractions
92                        (IntInfImp.quot (1000000 * Int32Imp.toLarge ticks,                        (IntInfImp.quot (TimeImp.fractionsPerSecond
93                                           * Int32Imp.toLarge ticks,
94                                         ticksPerSec)))                                         ticksPerSec)))
95    
96      fun times () = let      fun times () = let

Legend:
Removed from v.1470  
changed lines
  Added in v.1471

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0