Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
G
go-ipfs
概览
概览
详情
活动
周期分析
版本库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
jihao
go-ipfs
Commits
d4e0ad97
提交
d4e0ad97
authored
6月 06, 2015
作者:
Christian Couder
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Vendor github.com/chriscool/go-sleep
License: MIT Signed-off-by:
Christian Couder
<
chriscool@tuxfamily.org
>
上级
13cd226b
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
85 行增加
和
0 行删除
+85
-0
Godeps.json
Godeps/Godeps.json
+4
-0
LICENSE
Godeps/_workspace/src/github.com/chriscool/go-sleep/LICENSE
+22
-0
README.md
...ps/_workspace/src/github.com/chriscool/go-sleep/README.md
+32
-0
go-sleep.go
.../_workspace/src/github.com/chriscool/go-sleep/go-sleep.go
+27
-0
没有找到文件。
Godeps/Godeps.json
浏览文件 @
d4e0ad97
...
@@ -276,6 +276,10 @@
...
@@ -276,6 +276,10 @@
{
{
"ImportPath"
:
"gopkg.in/tomb.v1"
,
"ImportPath"
:
"gopkg.in/tomb.v1"
,
"Rev"
:
"dd632973f1e7218eb1089048e0798ec9ae7dceb8"
"Rev"
:
"dd632973f1e7218eb1089048e0798ec9ae7dceb8"
},
{
"ImportPath"
:
"github.com/chriscool/go-sleep"
,
"Rev"
:
"743ab5f1bb487edf1772bc29ca0bdf572b40785e"
}
}
]
]
}
}
Godeps/_workspace/src/github.com/chriscool/go-sleep/LICENSE
0 → 100644
浏览文件 @
d4e0ad97
The MIT License (MIT)
Copyright (c) 2014 Juan Batiz-Benet
Copyright (c) 2015 Christian Couder
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
Godeps/_workspace/src/github.com/chriscool/go-sleep/README.md
0 → 100644
浏览文件 @
d4e0ad97
# go-sleep sleeps for some duration
This unix tool is a thin wrapper around
`time.Sleep()`
.
It aims to provide a portable way to sleep for an amount of time that
need not to be a number of seconds.
See https://godoc.org/time#ParseDuration for how the duration can be
specified.
### Install
```
sh
go install github.com/chriscool/go-sleep
```
### Usage:
```
> go-sleep
Usage: go-sleep <duration>
Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h".
See https://godoc.org/time#ParseDuration for more.
> time go-sleep 100ms
real 0m0.104s
user 0m0.000s
sys 0m0.007s
```
### License
MIT
Godeps/_workspace/src/github.com/chriscool/go-sleep/go-sleep.go
0 → 100644
浏览文件 @
d4e0ad97
package
main
import
(
"fmt"
"os"
"time"
)
func
main
()
{
if
len
(
os
.
Args
)
!=
2
{
usageError
()
}
d
,
err
:=
time
.
ParseDuration
(
os
.
Args
[
1
])
if
err
!=
nil
{
fmt
.
Fprintf
(
os
.
Stderr
,
"Could not parse duration: %s
\n
"
,
err
)
usageError
()
}
time
.
Sleep
(
d
)
}
func
usageError
()
{
fmt
.
Fprintf
(
os
.
Stderr
,
"Usage: %s <duration>
\n
"
,
os
.
Args
[
0
])
fmt
.
Fprintln
(
os
.
Stderr
,
`Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h".`
)
fmt
.
Fprintln
(
os
.
Stderr
,
"See https://godoc.org/time#ParseDuration for more."
)
os
.
Exit
(
-
1
)
}
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论