|
@@ -38,8 +38,8 @@ ENDSTRUC
|
38
|
38
|
|
39
|
39
|
%macro TIMESPEC 1
|
40
|
40
|
%1: ISTRUC TIMESPEC_STRUC
|
41
|
|
- at TIMESPEC_STRUC.tv_sec, resq 1
|
42
|
|
- at TIMESPEC_STRUC.tv_nsec, resq 1
|
|
41
|
+ at TIMESPEC_STRUC.tv_sec, dq 0
|
|
42
|
+ at TIMESPEC_STRUC.tv_nsec, dq 0
|
43
|
43
|
IEND
|
44
|
44
|
%define %1.tv_sec %1+TIMESPEC_STRUC.tv_sec
|
45
|
45
|
%define %1.tv_nsec %1+TIMESPEC_STRUC.tv_nsec
|
|
@@ -68,18 +68,14 @@ ENDSTRUC
|
68
|
68
|
|
69
|
69
|
section .bss
|
70
|
70
|
align 8
|
71
|
|
- TIMESPEC ts_start
|
72
|
|
- TIMESPEC ts_cur
|
73
|
|
- TIMESPEC ts_sleep
|
74
|
71
|
buf: resb 1
|
75
|
72
|
|
76
|
73
|
section .data
|
|
74
|
+align 8
|
|
75
|
+ TIMESPEC ts_start
|
|
76
|
+ TIMESPEC ts_cur
|
|
77
|
+ TIMESPEC ts_sleep
|
77
|
78
|
|
78
|
|
- time_res: dq 2 ; 2 digits bellow seconds can grow to 8
|
79
|
|
- fcntl_flag: dq 0
|
80
|
|
- SIGACTION sigaction
|
81
|
|
-
|
82
|
|
- align 8
|
83
|
79
|
hours: times 8 db '0' ; 8 digits is the max for hours
|
84
|
80
|
timestr: db ":00:00."
|
85
|
81
|
times 8 db '0' ; 8 digits for nanoseconds
|
|
@@ -89,6 +85,11 @@ section .data
|
89
|
85
|
timestrlen: equ timestrend - timestr
|
90
|
86
|
%define HOURSLEN 8
|
91
|
87
|
|
|
88
|
+ time_res: dq 2 ; 2 digits bellow seconds can grow to 8
|
|
89
|
+
|
|
90
|
+ fcntl_flag: dq 0
|
|
91
|
+ SIGACTION sigaction
|
|
92
|
+
|
92
|
93
|
lapsmsg: db "Lap : "
|
93
|
94
|
lapsmsglen: equ $ - lapsmsg
|
94
|
95
|
|
|
@@ -182,7 +183,6 @@ syscall
|
182
|
183
|
|
183
|
184
|
; set value for ts_sleep.tv_nsec given time_res
|
184
|
185
|
; div sleep time by 10 for each digits added bellow seconds
|
185
|
|
-mov qword [ts_sleep.tv_sec], 0
|
186
|
186
|
mov rax, 100000000
|
187
|
187
|
mov r8, [time_res]
|
188
|
188
|
mov r9, 10
|
|
@@ -268,6 +268,9 @@ newline_exit:
|
268
|
268
|
mov rdi, 0 ; exit OK
|
269
|
269
|
jmp exit
|
270
|
270
|
|
|
271
|
+
|
|
272
|
+
|
|
273
|
+align 32
|
271
|
274
|
;
|
272
|
275
|
; Print current time on FD and add a leading char CHR
|
273
|
276
|
; push FD & push CHR to set arguments
|