Skip to content

Commit 2d22b30

Browse files
author
Steffen Pankratz
committed
Perf: Fix for creating unique file names on Windows
Fixes #104 Signed-off-by: Steffen Pankratz <steffen.pankratz@elektrobit.com>
1 parent febba38 commit 2d22b30

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

sources/perfsource.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,9 @@ func newSourceDefinition(def string) (*SourceDefinition, error) {
5050
return nil, fmt.Errorf("Invalid format. The source definition must be [Size]:[NumOfSources]. Failed to parse the number of sources. Error:%v", err)
5151
}
5252
names := make([]string, numOfSrcs)
53+
timestamp := time.Now().Nanosecond()
5354
for n := 0; n < numOfSrcs; n++ {
54-
names[n] = fmt.Sprintf("%s%v.dat", strings.Replace(def, ":", "_", 1), time.Now().Nanosecond())
55+
names[n] = fmt.Sprintf("%s_%v_%06d.dat", strings.Replace(def, ":", "_", 1), timestamp, n)
5556
}
5657

5758
return &SourceDefinition{Size: size, NumberOfSources: numOfSrcs, Names: names}, nil

0 commit comments

Comments
 (0)