Skip to content

Commit

Permalink
Merge pull request #265 from Code0x58/rfc3339-timestamps
Browse files Browse the repository at this point in the history
Use RFC3339 timestamps in the results
  • Loading branch information
kotakanbe authored Nov 16, 2016
2 parents 58958d6 + cda69dc commit ef21376
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 6 deletions.
2 changes: 1 addition & 1 deletion report/azureblob.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ func (w AzureBlobWriter) upload(res models.ScanResult) (err error) {
if err != nil {
return err
}
timestr := time.Now().Format("20060102_1504")
timestr := time.Now().Format(time.RFC3339)
name := ""
if len(res.Container.ContainerID) == 0 {
name = fmt.Sprintf("%s/%s.json", timestr, res.ServerName)
Expand Down
3 changes: 1 addition & 2 deletions report/json.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,7 @@ func LoadOneScanHistory(jsonDir string) (scanHistory models.ScanHistory, err err
if scanResults[0].ScannedAt.IsZero() {
splitPath := strings.Split(jsonDir, string(os.PathSeparator))
timeStr := splitPath[len(splitPath)-1]
timeformat := "20060102_1504"
if scannedAt, err = time.Parse(timeformat, timeStr); err != nil {
if scannedAt, err = time.Parse(time.RFC3339, timeStr); err != nil {
err = fmt.Errorf("Failed to parse %s: %s", timeStr, err)
return
}
Expand Down
2 changes: 1 addition & 1 deletion report/s3.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ func (w S3Writer) Write(scanResults []models.ScanResult) (err error) {

// http://docs.aws.amazon.com/sdk-for-go/latest/v1/developerguide/common-examples.title.html
svc := getS3()
timestr := time.Now().Format("20060102_1504")
timestr := time.Now().Format(time.RFC3339)
for _, r := range scanResults {
key := ""
if len(r.Container.ContainerID) == 0 {
Expand Down
3 changes: 1 addition & 2 deletions report/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@ import (
)

func ensureResultDir(scannedAt time.Time) (path string, err error) {
const timeLayout = "20060102_1504"
jsonDirName := scannedAt.Format(timeLayout)
jsonDirName := scannedAt.Format(time.RFC3339)

resultsDir := config.Conf.ResultsDir
if len(resultsDir) == 0 {
Expand Down

0 comments on commit ef21376

Please sign in to comment.