~ubuntu-branches/ubuntu/vivid/golang/vivid

« back to all changes in this revision

Viewing changes to src/pkg/syscall/syscall_nacl_amd64p32.go

  • Committer: Package Import Robot
  • Author(s): Serge Hallyn
  • Date: 2014-11-18 15:12:26 UTC
  • mfrom: (14.2.12 vivid-proposed)
  • Revision ID: package-import@ubuntu.com-20141118151226-zug7vn93mn3dtiz3
Tags: 2:1.3.2-1ubuntu1
* Merge from Debian unstable.  Remaining changes:
  - 016-armhf-elf-header.patch: Use correct ELF header for armhf binaries.
  - Support co-installability with gccgo-go tool:
    - d/rules,golang-go.install: Rename bin/go -> bin/golang-go
    - d/golang-go.{postinst,prerm}: Install/remove /usr/bin/go using
      alternatives.
  - d/copyright: Amendments for full compiliance with copyright format.
  - d/control: Demote golang-go.tools to Suggests to support Ubuntu MIR.
  - dropped patches (now upstream):
    - d/p/issue27650045_40001_50001.diff
    - d/p/issue28050043_60001_70001.diff
    - d/p/issue54790044_100001_110001.diff

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// Copyright 2013 The Go Authors.  All rights reserved.
 
2
// Use of this source code is governed by a BSD-style
 
3
// license that can be found in the LICENSE file.
 
4
 
 
5
package syscall
 
6
 
 
7
type Timespec struct {
 
8
        Sec  int64
 
9
        Nsec int32
 
10
}
 
11
 
 
12
type Timeval struct {
 
13
        Sec  int64
 
14
        Usec int32
 
15
}
 
16
 
 
17
func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) }
 
18
 
 
19
func NsecToTimespec(nsec int64) (ts Timespec) {
 
20
        ts.Sec = int64(nsec / 1e9)
 
21
        ts.Nsec = int32(nsec % 1e9)
 
22
        return
 
23
}
 
24
 
 
25
func TimevalToNsec(tv Timeval) int64 { return int64(tv.Sec)*1e9 + int64(tv.Usec)*1e3 }
 
26
 
 
27
func NsecToTimeval(nsec int64) (tv Timeval) {
 
28
        nsec += 999 // round up to microsecond
 
29
        tv.Usec = int32(nsec % 1e9 / 1e3)
 
30
        tv.Sec = int64(nsec / 1e9)
 
31
        return
 
32
}