-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
47 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
//go:build (linux && amd64) || (linux && arm64) | ||
|
||
package log | ||
|
||
func walltime() (sec int64, nsec int32) | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#include "textflag.h" | ||
|
||
#ifdef GOOS_linux | ||
#ifdef GOARCH_amd64 | ||
// func walltime() (sec int64, nsec int32) | ||
TEXT ·walltime(SB), NOSPLIT, $8-12 | ||
CALL runtime·nanotime1(SB) | ||
MOVQ AX, ret+0(FP) // sec | ||
MOVQ DX, ret+0(FP) // nsec | ||
RET | ||
#endif | ||
#endif | ||
|
||
#ifdef GOOS_linux | ||
#ifdef GOARCH_arm64 | ||
// func walltime() (sec int64, nsec int32) | ||
TEXT ·walltime(SB), NOSPLIT, $24-12 | ||
// Call runtime.walltime | ||
CALL runtime·walltime(SB) | ||
// Get the return values | ||
MOVD R3, ret+0(FP) // sec | ||
MOVW R5, ret+8(FP) // nsec | ||
RET | ||
#endif | ||
#endif | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
//go:build !((linux && amd64) || (linux && arm64)) | ||
|
||
package log | ||
|
||
import ( | ||
_ "unsafe" | ||
) | ||
|
||
//go:noescape | ||
//go:linkname time_now time.now | ||
func time_now() (sec int64, nsec int32, mono int64) | ||
|
||
func walltime() (sec int64, nsec int32) { | ||
sec, nsec = time_now() | ||
return | ||
} |