1
0
mirror of https://github.com/lxsang/Diya-API.git synced 2024-12-27 03:48:21 +01:00
Diya-API/Diya/DiyaClock.class.st

31 lines
523 B
Smalltalk
Raw Normal View History

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
]