Download Reference Manual
The Developer's Library for D
About Wiki Forums Source Search Contact

Changeset 2164

Show
Ignore:
Timestamp:
05/04/07 22:33:21 (2 years ago)
Author:
kris
Message:

- renamed util.time.Utc to be util.time.Clock
- renamed util.time.Wall to be util.time.WallClock?

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/example/networking/selector.d

    r2145 r2164  
    2525    import tango.net.SocketConduit; 
    2626    import tango.net.ServerSocket; 
    27     import tango.util.time.Utc
     27    import tango.util.time.Clock
    2828    import tango.util.log.Log; 
    2929    import tango.util.log.ConsoleAppender; 
     
    103103    uint        closeCount          = 0; 
    104104    uint        errorCount          = 0; 
    105     Time        start               = Utc.now; 
     105    Time        start               = Clock.now; 
    106106    Thread      clientThread; 
    107107 
     
    294294                    failedConnectCount, failedReceiveCount, failedSendCount, errorCount)); 
    295295 
    296     log.info(sprint("Total time: {0} ms", cast(uint) ((Utc.now - start) / start.TicksPerMillisecond))); 
     296    log.info(sprint("Total time: {0} ms", cast(uint) ((Clock.now - start) / start.TicksPerMillisecond))); 
    297297 
    298298    clientThread.join(); 
  • trunk/example/system/localtime.d

    r2163 r2164  
    77private import  tango.io.Stdout; 
    88 
    9 private import  tango.util.time.Wall
     9private import  tango.util.time.WallClock
    1010 
    1111/****************************************************************************** 
     
    1919{ 
    2020        // retreive local time 
    21         auto date = Wall.toDate; 
     21        auto date = WallClock.toDate; 
    2222 
    2323        // get GMT difference in minutes 
    24         auto tz = cast(int) (Wall.zone / Time.TicksPerMinute); 
     24        auto tz = cast(int) (WallClock.zone / Time.TicksPerMinute); 
    2525        char sign = '+'; 
    2626        if (tz < 0) 
  • trunk/install/snapshot/srcsnapshot.d

    r1905 r2164  
    77import tango.io.Stdout; 
    88 
    9 import tango.util.time.Date; 
    10 import tango.util.time.Utc; 
     9import tango.util.time.WallClock; 
    1110 
    1211char[] workdir; 
     
    9796 
    9897    Stdout("!! Exporting from working copy for packaging").newline; 
    99     Date date; 
    100     date.set(Utc.local); 
     98    auto date = WallClock.toDate; 
    10199    char[] datestr;  
    102100    datestr = Stdout.layout.sprint(new char[10], "{}{:2}{:2}", date.year, date.month, date.day); 
  • trunk/tango/io/FilePath.d

    r2097 r2164  
    2020private import  tango.io.FileConst; 
    2121 
    22 private import  tango.util.time.Utc; 
    23  
    2422private import  tango.core.Exception; 
     23 
     24private import  tango.util.time.Clock; 
     25 
    2526 
    2627/******************************************************************************* 
     
    921922 
    922923                        getInfo (info); 
    923                         time.modified = Utc.convert (info.ftLastWriteTime); 
    924                         time.accessed = Utc.convert (info.ftLastAccessTime); 
    925                         time.created  = Utc.convert (info.ftCreationTime); 
     924                        time.modified = Clock.convert (info.ftLastWriteTime); 
     925                        time.accessed = Clock.convert (info.ftLastAccessTime); 
     926                        time.created  = Clock.convert (info.ftCreationTime); 
    926927                        return time; 
    927928                } 
     
    12231224                        getInfo (stats); 
    12241225 
    1225                         time.modified = Utc.convert (*cast(timeval*) &stats.st_mtime); 
    1226                         time.accessed = Utc.convert (*cast(timeval*) &stats.st_atime); 
    1227                         time.created  = Utc.convert (*cast(timeval*) &stats.st_ctime); 
     1226                        time.modified = Clock.convert (*cast(timeval*) &stats.st_mtime); 
     1227                        time.accessed = Clock.convert (*cast(timeval*) &stats.st_atime); 
     1228                        time.created  = Clock.convert (*cast(timeval*) &stats.st_ctime); 
    12281229                        return time; 
    12291230                } 
  • trunk/tango/net/ftp/FtpClient.d

    r2159 r2164  
    1313module tango.net.ftp.FtpClient; 
    1414 
    15 private import tango.net.Socket; 
    16 private import tango.util.time.Utc; 
    17 private import tango.util.time.Date; 
    18 private import tango.net.ftp.Telnet; 
    19 private import tango.io.FileConduit; 
    20 private import tango.io.MemoryConduit; 
     15private import  tango.net.Socket; 
     16 
     17private import  tango.net.ftp.Telnet; 
     18 
     19private import  tango.util.time.Date, 
     20                tango.util.time.Clock; 
     21 
     22private import  tango.io.FileConduit, 
     23                tango.io.MemoryConduit; 
    2124 
    2225private import Text = tango.text.Util; 
     
    611614 
    612615                // At end_time, we bail. 
    613                 Time end_time = cast(Time) (Utc.now + this.timeout); 
    614  
    615                 while (Utc.now < end_time) 
     616                Time end_time = cast(Time) (Clock.now + this.timeout); 
     617 
     618                while (Clock.now < end_time) 
    616619                    { 
    617620                        set.reset(); 
     
    13521355        date.min   = Integer.atoi (timeval[10..12]); 
    13531356        date.sec   = Integer.atoi (timeval[12..14]); 
    1354         return Utc.fromDate (date); 
     1357        return Clock.fromDate (date); 
    13551358    } 
    13561359 
     
    15391542 
    15401543        // At end_time, we bail. 
    1541         Time end_time = cast(Time) (Utc.now + this.timeout); 
     1544        Time end_time = cast(Time) (Clock.now + this.timeout); 
    15421545 
    15431546        // This is the buffer the stream data is stored in. 
     
    15481551        size_t pos = 0; 
    15491552        bool completed = false; 
    1550         while (!completed && Utc.now < end_time) 
     1553        while (!completed && Clock.now < end_time) 
    15511554            { 
    15521555                set.reset(); 
     
    15781581                // Give it more time as long as data is going through. 
    15791582                if (delta != 0) 
    1580                     end_time = cast(Time) (Utc.now + this.timeout); 
     1583                    end_time = cast(Time) (Clock.now + this.timeout); 
    15811584            } 
    15821585 
     
    16061609 
    16071610        // At end_time, we bail. 
    1608         Time end_time = cast(Time) (Utc.now + this.timeout); 
     1611        Time end_time = cast(Time) (Clock.now + this.timeout); 
    16091612 
    16101613        // This is the buffer the stream data is stored in. 
     
    16141617        bool completed = false; 
    16151618        size_t pos; 
    1616         while (Utc.now < end_time) 
     1619        while (Clock.now < end_time) 
    16171620            { 
    16181621                set.reset(); 
     
    16411644 
    16421645                // Give it more time as long as data is going through. 
    1643                 end_time = cast(Time) (Utc.now + this.timeout); 
     1646                end_time = cast(Time) (Clock.now + this.timeout); 
    16441647            } 
    16451648 
     
    17501753 
    17511754        // Pick a time at which we stop reading.  It can't take too long, but it could take a bit for the whole response. 
    1752         Time end_time = cast(Time) (Utc.now + this.timeout * 10); 
     1755        Time end_time = cast(Time) (Clock.now + this.timeout * 10); 
    17531756 
    17541757        FtpResponse response; 
     
    17561759 
    17571760        // Danger, Will Robinson, don't fall into an endless loop from a malicious server. 
    1758         while (Utc.now < end_time) 
     1761        while (Clock.now < end_time) 
    17591762            { 
    17601763                single_line = this.readLine(); 
  • trunk/tango/net/ftp/Telnet.d

    r2145 r2164  
    1515private import tango.net.Socket; 
    1616 
    17 private import tango.util.time.Utc; 
    18  
    1917private import tango.core.Exception; 
     18 
     19private import tango.util.time.Clock; 
    2020 
    2121private import Integer = tango.text.convert.Integer; 
     
    6262        { 
    6363                // At end_time, we bail. 
    64                 Time end_time = cast(Time) (Utc.now + this.timeout); 
     64                Time end_time = cast(Time) (Clock.now + this.timeout); 
    6565 
    6666                // Set up a SocketSet so we can use select() - it's pretty efficient. 
     
    7070 
    7171                size_t pos = 0; 
    72                 while (Utc.now < end_time) 
     72                while (Clock.now < end_time) 
    7373                { 
    7474                        set.reset(); 
     
    101101        { 
    102102                // Figure, first, how long we're allowed to take. 
    103                 Time end_time = cast(Time) (Utc.now + this.timeout); 
     103                Time end_time = cast(Time) (Clock.now + this.timeout); 
    104104 
    105105                // An overall buffer and a one-char buffer. 
     
    129129                        delete set; 
    130130 
    131                 while (Utc.now < end_time) 
     131                while (Clock.now < end_time) 
    132132                { 
    133133                        set.reset(); 
  • trunk/tango/text/convert/TimeStamp.d

    r2159 r2164  
    3232private import tango.core.Exception; 
    3333 
    34 private import tango.util.time.Utc
    35                tango.util.time.Date
     34private import tango.util.time.Date
     35               tango.util.time.Clock
    3636 
    3737private import Util = tango.text.Util; 
     
    141141 
    142142        // convert time to field values 
    143         auto date = Utc.toDate (time); 
     143        auto date = Clock.toDate (time); 
    144144 
    145145        // use the featherweight formatter ... 
     
    217217            p[0..3] == "GMT") 
    218218            { 
    219             value = Utc.fromDate (date); 
     219            value = Clock.fromDate (date); 
    220220            return (p+3) - src.ptr; 
    221221            } 
     
    263263                   date.year += 1900; 
    264264 
    265             value = Utc.fromDate (date); 
     265            value = Clock.fromDate (date); 
    266266            return (p+3) - src.ptr; 
    267267            } 
     
    302302            (date.year = parseInt (p)) > 0) 
    303303            { 
    304             value = Utc.fromDate (date); 
     304            value = Clock.fromDate (date); 
    305305            return p - src.ptr; 
    306306            } 
     
    348348                   date.year += 1900; 
    349349             
    350             value = Utc.fromDate (date); 
     350            value = Clock.fromDate (date); 
    351351            return (p+2) - src.ptr; 
    352352            } 
     
    384384            (date.ms = parseInt(p)) > 0) 
    385385            { 
    386             value = Utc.fromDate (date); 
     386            value = Clock.fromDate (date); 
    387387            return p - src.ptr; 
    388388            } 
  • trunk/tango/text/locale/Convert.d

    r2154 r2164  
    1313module tango.text.locale.Convert; 
    1414 
    15 private import tango.text.locale.Core; 
    16  
    17 private import  tango.util.time.Wall
    18                 tango.util.time.DateTime
     15private import tango.text.locale.Core; 
     16 
     17private import  tango.util.time.DateTime
     18                tango.util.time.WallClock
    1919 
    2020private import  tango.util.time.chrono.Calendar; 
    2121 
    22 private import Integer = tango.text.convert.Integer; 
     22private import Integer = tango.text.convert.Integer; 
    2323 
    2424/****************************************************************************** 
     
    412412else 
    413413{ 
    414                                   auto minutes = cast(int) (Wall.zone / Time.TicksPerMinute); 
     414                                  auto minutes = cast(int) (WallClock.zone / Time.TicksPerMinute); 
    415415                                  if (minutes < 0) 
    416416                                      minutes = -minutes, result ~= '-'; 
  • trunk/tango/util/log/DateLayout.d

    r2160 r2164  
    1818private import  tango.text.Util; 
    1919 
    20 private import  tango.util.time.Utc
    21                 tango.util.time.Wall
     20private import  tango.util.time.Clock
     21                tango.util.time.WallClock
    2222 
    2323private import  Int = tango.text.convert.Integer; 
     
    6060                // convert time to field values 
    6161                auto time = event.getEpochTime; 
    62                 auto date = (localTime) ? Wall.toDate(time) : Utc.toDate(time); 
     62                auto date = (localTime) ? WallClock.toDate(time) : Clock.toDate(time); 
    6363                                 
    6464                // format date according to ISO-8601 (lightweight formatter) 
  • trunk/tango/util/log/Event.d

    r2145 r2164  
    1818private import  tango.sys.Common; 
    1919 
    20 private import  tango.util.time.Utc
     20private import  tango.util.time.Clock
    2121 
    2222private import  tango.util.log.model.ILevel, 
     
    140140                version (Posix)        
    141141                { 
    142                         beginTime = Utc.now; 
     142                        beginTime = Clock.now; 
    143143                } 
    144144 
     
    152152                        QueryPerformanceCounter (&timerStart); 
    153153                        multiplier = 10_000_000.0 / freq;        
    154                         beginTime = Utc.now; 
     154                        beginTime = Clock.now; 
    155155 
    156156                } 
     
    178178                version (Posix)        
    179179                { 
    180                         return Utc.now; 
     180                        return Clock.now; 
    181181                } 
    182182 
  • trunk/tango/util/time/Date.d

    r2163 r2164  
    1313module tango.util.time.Date; 
    1414 
    15 private import tango.sys.Common; 
    16  
    17 private import tango.util.time.Utc; 
    18  
    1915/******************************************************************************* 
    2016 
     
    2319        fields to the current UTC time: 
    2420        --- 
    25         auto date = Utc.toDate; 
     21        auto date = Clock.toDate; 
    2622        --- 
    2723 
  • trunk/tango/util/time/DateTime.d

    r2158 r2164  
    66 
    77        version:        mid 2005: Initial release 
    8                         Apr 2007: reshaped 
     8                        Apr 2007: heavily reshaped 
    99 
    1010        author:         John Chapman, Kris 
     
    1414module tango.util.time.DateTime; 
    1515 
    16 private import tango.util.time.Utc; 
    17 private import tango.util.time.Wall
     16private import tango.util.time.Clock, 
     17                tango.util.time.WallClock
    1818 
    1919/****************************************************************************** 
     
    159159        static DateTime now ()  
    160160        { 
    161                 return DateTime (Wall.now); 
     161                return DateTime (WallClock.now); 
    162162        } 
    163163 
     
    174174        static DateTime utc ()  
    175175        { 
    176                 return DateTime (Utc.now); 
     176                return DateTime (Clock.now); 
    177177        } 
    178178 
  • trunk/tango/util/time/WallClock.d

    r2163 r2164  
    1111*******************************************************************************/ 
    1212 
    13 module tango.util.time.Wall
     13module tango.util.time.WallClock
    1414 
    1515private import  tango.sys.Common; 
    1616 
    17 private import  tango.util.time.Utc
    18                 tango.util.time.Date
     17private import  tango.util.time.Date
     18                tango.util.time.Clock
    1919 
    2020public  import  tango.core.Type : Time; 
     
    2222/****************************************************************************** 
    2323 
    24         Exposes Wall time relative to Jan 1st, 1 AD. These values are 
     24        Exposes wall-time relative to Jan 1st, 1 AD. These values are 
    2525        based upon a clock-tick of 100ns, giving them a span of greater 
    2626        than 10,000 years. Units of Time are the foundation of most time 
     
    3737*******************************************************************************/ 
    3838 
    39 struct Wall 
     39struct WallClock 
    4040{ 
    4141        version (Win32) 
     
    4949                static Time now () 
    5050                { 
    51                         return cast(Time) (Utc.now - localBias); 
     51                        return cast(Time) (Clock.now - localBias); 
    5252                } 
    5353 
     
    7777                static Date toDate () 
    7878                { 
    79                         return toDate (Utc.now); 
     79                        return toDate (Clock.now); 
    8080                } 
    8181 
     
    9090                static Date toDate (Time time) 
    9191                { 
    92                         return Utc.toDate (cast(Time) (time - localBias)); 
     92                        return Clock.toDate (cast(Time) (time - localBias)); 
    9393                } 
    9494 
     
    101101                static Time fromDate (inout Date date) 
    102102                { 
    103                         return cast(Time) (Utc.fromDate(date) + localBias); 
     103                        return cast(Time) (Clock.fromDate(date) + localBias); 
    104104                } 
    105105 
     
    150150                        localtime_r (&tv.tv_sec, &t); 
    151151                        tv.tv_sec = timegm (&t); 
    152                         return Utc.convert (tv); 
     152                        return Clock.convert (tv); 
    153153                } 
    154154 
     
    182182                static Date toDate () 
    183183                { 
    184                         return toDate (Utc.now); 
     184                        return toDate (Clock.now); 
    185185                } 
    186186 
     
    196196                { 
    197197                        Date date = void; 
    198                         auto timeval = Utc.convert (time); 
     198                        auto timeval = Clock.convert (time); 
    199199                        date.ms = timeval.tv_usec / 1000; 
    200200