Changeset 8572


Ignore:
Timestamp:
02/14/05 19:05:33 (16 years ago)
Author:
piso
Message:

GET-INTERNAL-RUN-TIME

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/j/src/org/armedbear/lisp/Time.java

    r8411 r8572  
    33 *
    44 * Copyright (C) 2003-2005 Peter Graves
    5  * $Id: Time.java,v 1.25 2005-01-30 02:35:37 piso Exp $
     5 * $Id: Time.java,v 1.26 2005-02-14 19:05:33 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    3737            long systemStart = -1;
    3838            try {
    39                 userStart = ControlC.getCurrentThreadUserTime();
    40                 systemStart = ControlC.getCurrentThreadSystemTime();
     39                userStart = Native.getCurrentThreadUserTime();
     40                systemStart = Native.getCurrentThreadSystemTime();
    4141            }
    4242            catch (Throwable t) {}
     
    5050                long systemStop = -1;
    5151                if (userStart > 0) {
    52                     userStop = ControlC.getCurrentThreadUserTime();
    53                     systemStop = ControlC.getCurrentThreadSystemTime();
     52                    userStop = Native.getCurrentThreadUserTime();
     53                    systemStop = Native.getCurrentThreadSystemTime();
    5454                }
    5555                long count = Cons.getCount();
     
    8484    // ### get-internal-real-time
    8585    private static final Primitive GET_INTERNAL_REAL_TIME =
    86         new Primitive("get-internal-real-time","") {
     86        new Primitive("get-internal-real-time", "")
     87    {
    8788        public LispObject execute() throws ConditionThrowable
    8889        {
     
    9394    // ### get-internal-run-time
    9495    private static final Primitive GET_INTERNAL_RUN_TIME =
    95         new Primitive("get-internal-run-time","") {
     96        new Primitive("get-internal-run-time", "")
     97    {
    9698        public LispObject execute() throws ConditionThrowable
    9799        {
    98             return number(System.currentTimeMillis()); // FIXME
     100            if (Utilities.isPlatformUnix()) {
     101                long userTime = -1;
     102                long systemTime = -1;
     103                try {
     104                    userTime = Native.getCurrentThreadUserTime();
     105                    systemTime = Native.getCurrentThreadSystemTime();
     106                }
     107                catch (Throwable t) {}
     108                if (userTime >= 0 && systemTime >= 0)
     109                    return number((userTime + systemTime) * 10);
     110            }
     111            return number(System.currentTimeMillis());
    99112        }
    100113    };
     
    102115    // ### get-universal-time
    103116    private static final Primitive GET_UNIVERSAL_TIME =
    104         new Primitive("get-universal-time","") {
     117        new Primitive("get-universal-time", "")
     118    {
    105119        public LispObject execute()
    106120        {
Note: See TracChangeset for help on using the changeset viewer.