]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: use clock_gettime for time.now() on s390x
authorMichael Munday <munday@ca.ibm.com>
Wed, 24 Aug 2016 21:44:27 +0000 (17:44 -0400)
committerBrad Fitzpatrick <bradfitz@golang.org>
Thu, 25 Aug 2016 02:05:31 +0000 (02:05 +0000)
This should improve the precision of time.now() from microseconds
to nanoseconds.

Also, modify runtime.nanotime to keep it consistent with cleanup
done to time.now.

Updates #11222 for s390x.

Change-Id: I27864115ea1fee7299360d9003cd3a8355f624d3
Reviewed-on: https://go-review.googlesource.com/27710
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
src/runtime/sys_linux_s390x.s

index f43792bd513cec76613a4c365fe67aac7a24bcc9..4922f6158f7ce736914eb368973d4459b0ac0c52 100644 (file)
@@ -171,30 +171,26 @@ TEXT runtime·mincore(SB),NOSPLIT|NOFRAME,$0-28
 
 // func now() (sec int64, nsec int32)
 TEXT time·now(SB),NOSPLIT,$16
-       MOVD    $0(R15), R2
-       MOVD    $0, R3
-       MOVW    $SYS_gettimeofday, R1
-       SYSCALL
-       MOVD    0(R15), R2      // sec
-       MOVD    8(R15), R4      // usec
-       MOVD    $1000, R3
-       MULLD   R3, R4
+       MOVW    $0, R2 // CLOCK_REALTIME
+       MOVD    $tp-16(SP), R3
+       MOVW    $SYS_clock_gettime, R1
+       SYSCALL
+       LMG     tp-16(SP), R2, R3
+       // sec is in R2, nsec in R3
        MOVD    R2, sec+0(FP)
-       MOVW    R4, nsec+8(FP)
+       MOVW    R3, nsec+8(FP)
        RET
 
 TEXT runtime·nanotime(SB),NOSPLIT,$16
        MOVW    $1, R2 // CLOCK_MONOTONIC
-       MOVD    $0(R15), R3
+       MOVD    $tp-16(SP), R3
        MOVW    $SYS_clock_gettime, R1
        SYSCALL
-       MOVD    0(R15), R2      // sec
-       MOVD    8(R15), R4      // nsec
-       // sec is in R2, nsec in R4
+       LMG     tp-16(SP), R2, R3
+       // sec is in R2, nsec in R3
        // return nsec in R2
-       MOVD    $1000000000, R3
-       MULLD   R3, R2
-       ADD     R4, R2
+       MULLD   $1000000000, R2
+       ADD     R3, R2
        MOVD    R2, ret+0(FP)
        RET