mirror of
https://github.com/idanoo/go-mastodon-stats
synced 2025-07-01 13:52:20 +00:00
Timestamp
This commit is contained in:
parent
31ad65d711
commit
43514cc0b0
2 changed files with 1 additions and 21 deletions
|
@ -165,7 +165,7 @@ func getLastWeekMetric(serviceName string) int {
|
|||
val, err := runIntQuery(
|
||||
POSTGRESQL_STATS_DB,
|
||||
fmt.Sprintf(
|
||||
"SELECT metric_value FROM %s WHERE metric_name = '%s' AND service = '%s' AND metric_time = '%d' LIMIT 1",
|
||||
"SELECT metric_value FROM %s WHERE metric_name = '%s' AND service = '%s' AND metric_time = '%s' LIMIT 1",
|
||||
POSTGRESQL_STATS_TABLE,
|
||||
METRICNAME_USERCOUNT,
|
||||
serviceName,
|
||||
|
|
20
test.go
20
test.go
|
@ -1,20 +0,0 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"log"
|
||||
"time"
|
||||
)
|
||||
|
||||
func main() {
|
||||
localTime, err := time.LoadLocation("Pacific/Auckland")
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
// Iterate until Monday!
|
||||
t := time.Now().In(localTime)
|
||||
for t.Weekday() != time.Monday {
|
||||
t = t.AddDate(0, 0, -1)
|
||||
}
|
||||
year, month, day := t.Date()
|
||||
log.Println(time.Date(year, month, day, 0, 0, 0, 0, t.Location()))
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue