Skip to content

Commit eadae0e

Browse files
Added Time Package and
1 parent a83b6fa commit eadae0e

4 files changed

Lines changed: 56 additions & 2 deletions

File tree

Main/Main.ezcode

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ class bool {
1111
nocol method ! {
1212
Value => runexec EZCodeLanguage.EZHelp.Compare ~> not, {val}
1313
}
14+
method oposite : @bool:__bol => @bool {
15+
return runexec EZCodeLanguage.EZHelp.Compare ~> not, {__bol}
16+
}
1417
method is-type : val => @bool {
1518
try {
1619
runexec EZCodeLanguage.EZHelp.BoolParse ~> {val}

Main/math.ezcode

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,12 @@ global nocol method avg : ! @float:nums => @float {
1616
global nocol method clamp : @float:val, @float:min, @float:max => @float {
1717
return runexec EZCodeLanguage.EZHelp.Clamp ~> {val}, {min}, {max}
1818
}
19-
global nocol method random : @float:min, @float:max => @float {
19+
global nocol method random : @float:min, @float:max => @int {
2020
return runexec EZCodeLanguage.EZHelp.RandomNumber ~> {min}, {max}
2121
}
22+
global nocol method round-to-int : @float:num => @int {
23+
return runexec EZCodeLanguage.EZHelp.RoundToInt ~> {num}
24+
}
2225
global method pi => @float {
2326
return runexec EZCodeLanguage.EZHelp.Pi
2427
}

time/stopwatch.ezcode

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,25 @@
11
class stopwatch {
2-
2+
undefined Value
3+
4+
method start {
5+
Value => runexec EZCodeLanguage.EZHelp.StopwatchStart
6+
}
7+
method end {
8+
return runexec EZCodeLanguage.EZHelp.StopwatchEnd ~> {Value}
9+
}
10+
method elapsed-nanoseconds => @float {
11+
return runexec EZCodeLanguage.EZHelp.StopwatchElapsedNanoseconds ~> {Value}
12+
}
13+
method elapsed-miliseconds => @float {
14+
return runexec EZCodeLanguage.EZHelp.StopwatchElapsedMiliseconds ~> {Value}
15+
}
16+
method elapsed-seconds => @float {
17+
return runexec EZCodeLanguage.EZHelp.StopwatchElapsedSeconds ~> {Value}
18+
}
19+
method elapsed-minutes => @float {
20+
return runexec EZCodeLanguage.EZHelp.StopwatchElapsedMinutes ~> {Value}
21+
}
22+
method elapsed-hours => @float {
23+
return runexec EZCodeLanguage.EZHelp.StopwatchElapsedHours ~> {Value}
24+
}
325
}

time/timer.ezcode

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
class timer {
2+
undefined Value
3+
4+
int hours new : 0
5+
int minutes new : 0
6+
int seconds new : 0
7+
int miliseconds new : 0
8+
9+
method new-instance : @int:_hours, @int:_minutes, @int:_seconds, @int:_miliseconds => @timer {
10+
return runexec EZCodeLanguage.EZHelp.TimerNewInstance ~> {_hours}, {_minutes}, {_seconds}, {_miliseconds}
11+
}
12+
method start {
13+
Value => new-instance : hours, minutes, seconds, miliseconds
14+
runexec EZCodeLanguage.EZHelp.TimerStart ~> {Value}
15+
}
16+
method stop {
17+
runexec EZCodeLanguage.EZHelp.TimerStop ~> {Value}
18+
}
19+
method is-done => @bool {
20+
return runexec EZCodeLanguage.EZHelp.TimerIsDone ~> {Value}
21+
}
22+
method is-not-done => @bool {
23+
bool _t new => is-done
24+
return bool oposite : _t
25+
}
26+
}

0 commit comments

Comments
 (0)