summaryrefslogtreecommitdiff
path: root/src/pkg/time
diff options
context:
space:
mode:
authorRobert Griesemer <gri@golang.org>2009-11-06 14:24:38 -0800
committerRobert Griesemer <gri@golang.org>2009-11-06 14:24:38 -0800
commit828334dd95ce8e4bf3662bd5c89d7c417f0741d0 (patch)
treefd7e0c9961bc3af2ddf105e9cc1943f2509ac584 /src/pkg/time
parenteb5cdfd67ff6d32df4c4c27840eaee027c5e3512 (diff)
downloadgolang-828334dd95ce8e4bf3662bd5c89d7c417f0741d0.tar.gz
- fine-tuning of one-line func heuristic (nodes.go)
- enabled for function declarations (not just function literals) - applied gofmt -w $GOROOT/src (look for instance at src/pkg/debug/elf/elf.go) R=r, rsc CC=go-dev http://go/go-review/1026006
Diffstat (limited to 'src/pkg/time')
-rw-r--r--src/pkg/time/sleep.go4
-rw-r--r--src/pkg/time/tick.go4
-rw-r--r--src/pkg/time/time.go24
3 files changed, 8 insertions, 24 deletions
diff --git a/src/pkg/time/sleep.go b/src/pkg/time/sleep.go
index ee57edd45..e94057a16 100644
--- a/src/pkg/time/sleep.go
+++ b/src/pkg/time/sleep.go
@@ -11,6 +11,4 @@ import (
// Sleep pauses the current goroutine for ns nanoseconds.
// It returns os.EINTR if interrupted.
-func Sleep(ns int64) os.Error {
- return os.NewSyscallError("sleep", syscall.Sleep(ns));
-}
+func Sleep(ns int64) os.Error { return os.NewSyscallError("sleep", syscall.Sleep(ns)) }
diff --git a/src/pkg/time/tick.go b/src/pkg/time/tick.go
index 01ffef4a1..771fc9f7e 100644
--- a/src/pkg/time/tick.go
+++ b/src/pkg/time/tick.go
@@ -29,9 +29,7 @@ type Ticker struct {
}
// Stop turns off a ticker. After Stop, no more ticks will be delivered.
-func (t *Ticker) Stop() {
- t.shutdown = true;
-}
+func (t *Ticker) Stop() { t.shutdown = true }
func (t *Ticker) ticker(c chan<- int64) {
now := Nanoseconds();
diff --git a/src/pkg/time/time.go b/src/pkg/time/time.go
index 3b626bbab..72cd34822 100644
--- a/src/pkg/time/time.go
+++ b/src/pkg/time/time.go
@@ -145,9 +145,7 @@ func SecondsToUTC(sec int64) *Time {
}
// UTC returns the current time as a parsed Time value in the UTC time zone.
-func UTC() *Time {
- return SecondsToUTC(Seconds());
-}
+func UTC() *Time { return SecondsToUTC(Seconds()) }
// SecondsToLocalTime converts sec, in number of seconds since the Unix epoch,
// into a parsed Time value in the local time zone.
@@ -160,9 +158,7 @@ func SecondsToLocalTime(sec int64) *Time {
}
// LocalTime returns the current time as a parsed Time value in the local time zone.
-func LocalTime() *Time {
- return SecondsToLocalTime(Seconds());
-}
+func LocalTime() *Time { return SecondsToLocalTime(Seconds()) }
// Seconds returns the number of seconds since January 1, 1970 represented by the
// parsed Time value.
@@ -340,24 +336,16 @@ func format(t *Time, fmt string) string {
// Asctime formats the parsed time value in the style of
// ANSI C asctime: Sun Nov 6 08:49:37 1994
-func (t *Time) Asctime() string {
- return format(t, "%a %b %e %H:%M:%S %Y");
-}
+func (t *Time) Asctime() string { return format(t, "%a %b %e %H:%M:%S %Y") }
// RFC850 formats the parsed time value in the style of
// RFC 850: Sunday, 06-Nov-94 08:49:37 UTC
-func (t *Time) RFC850() string {
- return format(t, "%A, %d-%b-%y %H:%M:%S %Z");
-}
+func (t *Time) RFC850() string { return format(t, "%A, %d-%b-%y %H:%M:%S %Z") }
// RFC1123 formats the parsed time value in the style of
// RFC 1123: Sun, 06 Nov 1994 08:49:37 UTC
-func (t *Time) RFC1123() string {
- return format(t, "%a, %d %b %Y %H:%M:%S %Z");
-}
+func (t *Time) RFC1123() string { return format(t, "%a, %d %b %Y %H:%M:%S %Z") }
// String formats the parsed time value in the style of
// date(1) - Sun Nov 6 08:49:37 UTC 1994
-func (t *Time) String() string {
- return format(t, "%a %b %e %H:%M:%S %Z %Y");
-}
+func (t *Time) String() string { return format(t, "%a %b %e %H:%M:%S %Z %Y") }