]> 127.0.0.1 Git - part/.git/commitdiff
25
authorqydysky <qydysky@foxmail.com>
Sat, 1 Aug 2020 20:41:51 +0000 (04:41 +0800)
committerqydysky <qydysky@foxmail.com>
Sat, 1 Aug 2020 20:41:51 +0000 (04:41 +0800)
Flate.go [moved from flate.go with 100% similarity]
Limit.go
Sys.go

similarity index 100%
rename from flate.go
rename to Flate.go
index 7970bfa90a2e72a467fda8696a5415a038133c62..ae46d1ecec237e9fef610e41e6658e7c78a8577d 100644 (file)
--- a/Limit.go
+++ b/Limit.go
@@ -29,7 +29,7 @@ func Limit(Max,Second,TimeOut int) (*Limitl) {
                        for i:=1;i<=Max;i++{
                                returnVal.Channl <- true
                        }
-                       time.Sleep(time.Duration(Second)*time.Second)
+                       time.Sleep(time.Duration(Second)*time.Millisecond)
                }
        }(&returnVal)
 
@@ -40,7 +40,7 @@ func (l *Limitl) TO() bool {
        if l.Stop {return false}
        select {
                case <-l.Channl :;
-               case <-time.After(time.Duration(l.TimeOut)*time.Second):return true;
+               case <-time.After(time.Duration(l.TimeOut)*time.Millisecond):return true;
        }
        return false
 }
\ No newline at end of file
diff --git a/Sys.go b/Sys.go
index fb76af5dbdc5010adefecd196d773673e91f86cf..f53d6e7685747e0c3f79b16455efe2f6facbef50 100644 (file)
--- a/Sys.go
+++ b/Sys.go
@@ -119,7 +119,7 @@ func (this *sys) SetProxy(s,pac string) error {
     return Ppart.PProxy(s,pac);
 }
 
-func GetCpuPercent() (float64,error) {
+func (this *sys) GetCpuPercent() (float64,error) {
        if a,e := gopsutilLoad.Avg();e == nil{
                if i,e:=gopsutilCpu.Counts(true);e == nil{
                        return (*a).Load1/float64(i),nil