Skip to content

Commit

Permalink
runtime: Use clock_gettime to get current time on ppc64x
Browse files Browse the repository at this point in the history
Fetch the current time in nanoseconds, not microseconds, by using
clock_gettime rather than gettimeofday.

Updates golang#11222

Change-Id: I1c2c1b88f80ae82002518359436e19099061c6fb
  • Loading branch information
ceseo committed Aug 23, 2016
1 parent 31b6897 commit 9cdb200
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/runtime/sys_linux_ppc64x.s
Original file line number Diff line number Diff line change
Expand Up @@ -159,13 +159,11 @@ TEXT runtime·mincore(SB),NOSPLIT|NOFRAME,$0-28

// func now() (sec int64, nsec int32)
TEXT time·now(SB),NOSPLIT,$16
MOVD $0(R1), R3
MOVD $0, R4
SYSCALL $SYS_gettimeofday
MOVD $0, R3 // CLOCK_REALTIME
MOVD $0(R1), R4
SYSCALL $SYS_clock_gettime
MOVD 0(R1), R3 // sec
MOVD 8(R1), R5 // usec
MOVD $1000, R4
MULLD R4, R5
MOVD 8(R1), R5 // nsec
MOVD R3, sec+0(FP)
MOVW R5, nsec+8(FP)
RET
Expand Down

0 comments on commit 9cdb200

Please sign in to comment.