2022-02-15 18:04:54 +01:00
|
|
|
Class {
|
|
|
|
#name : #DiyaClock,
|
|
|
|
#superclass : #DiyaSingleton,
|
|
|
|
#instVars : [
|
2022-03-06 18:33:10 +01:00
|
|
|
'monotonic',
|
|
|
|
'lastTick'
|
2022-02-15 18:04:54 +01:00
|
|
|
],
|
|
|
|
#category : #'Diya-Runtime'
|
|
|
|
}
|
|
|
|
|
2022-03-06 18:33:10 +01:00
|
|
|
{ #category : #initialization }
|
|
|
|
DiyaClock >> delta [
|
|
|
|
^(DateAndTime now) - lastTick
|
|
|
|
]
|
|
|
|
|
2022-02-15 18:04:54 +01:00
|
|
|
{ #category : #initialization }
|
|
|
|
DiyaClock >> elapsedTime [
|
|
|
|
^(DateAndTime now) - monotonic
|
|
|
|
]
|
|
|
|
|
|
|
|
{ #category : #initialization }
|
|
|
|
DiyaClock >> initialize [
|
|
|
|
monotonic := DateAndTime now.
|
2022-03-06 18:33:10 +01:00
|
|
|
lastTick := monotonic.
|
|
|
|
]
|
|
|
|
|
|
|
|
{ #category : #initialization }
|
|
|
|
DiyaClock >> tick [
|
|
|
|
lastTick := DateAndTime now.
|
2022-02-15 18:04:54 +01:00
|
|
|
]
|