diff --git a/internal/cli/run/run.go b/internal/cli/run/run.go index 5544153..b6125bc 100644 --- a/internal/cli/run/run.go +++ b/internal/cli/run/run.go @@ -12,6 +12,7 @@ import ( "github.com/ooni/probe-cli/internal/database" "github.com/ooni/probe-cli/nettests" "github.com/ooni/probe-cli/nettests/groups" + "github.com/ooni/probe-cli/utils" ) func init() { @@ -55,7 +56,7 @@ func init() { log.Debugf("Running test %T", nt) msmtPath := filepath.Join(ctx.TempDir, fmt.Sprintf("msmt-%T-%s.jsonl", nt, - time.Now().UTC().Format(time.RFC3339Nano))) + time.Now().UTC().Format(utils.ResultTimestamp))) ctl := nettests.NewController(nt, ctx, result, msmtPath) if err = nt.Run(ctl); err != nil { diff --git a/utils/paths.go b/utils/paths.go index cf37c86..63ce079 100644 --- a/utils/paths.go +++ b/utils/paths.go @@ -30,12 +30,13 @@ func DBDir(home string, name string) string { return filepath.Join(home, "db", fmt.Sprintf("%s.sqlite3", name)) } -const resultdirFormat = "2006-01-02T150405.999999999Z0700" +// ResultTimestamp is a windows friendly timestamp +const ResultTimestamp = "2006-01-02T150405.999999999Z0700" // MakeResultsDir creates and returns a directory for the result func MakeResultsDir(home string, name string, ts time.Time) (string, error) { p := filepath.Join(home, "msmts", - fmt.Sprintf("%s-%s", name, ts.Format(resultdirFormat))) + fmt.Sprintf("%s-%s", name, ts.Format(ResultTimestamp))) // If the path already exists, this is a problem. It should not clash, because // we are using nanosecond precision for the starttime.