Merge pull request #1 from allisonmorgan/master

Included more time stamps of various precision
This commit is contained in:
Aaron Raddon 2014-10-02 22:17:40 -07:00
commit 6b774e2c87

View File

@ -125,6 +125,14 @@ iterRunes:
case ST_DIGITDASHT: // starts digit then dash 02- then T
// 2006-01-02T15:04:05Z07:00
// 2006-01-02T15:04:05.999999999Z07:00
// 2006-01-02T15:04:05.999999999Z
// 2006-01-02T15:04:05.99999999Z
// 2006-01-02T15:04:05.9999999Z
// 2006-01-02T15:04:05.999999Z
// 2006-01-02T15:04:05.99999Z
// 2006-01-02T15:04:05.9999Z
// 2006-01-02T15:04:05.999Z
// 2006-01-02T15:04:05.99Z
if len(datestr) == len("2006-01-02T15:04:05Z07:00") {
if t, err := time.Parse("2006-01-02T15:04:05Z07:00", datestr); err == nil {
return t, nil
@ -137,6 +145,27 @@ iterRunes:
} else {
return time.Time{}, err
}
} else {
// updated to include timestamps of different precisions
if t, err := time.Parse("2006-01-02T15:04:05.999999999Z", datestr); err == nil {
return t, nil
} else if t, err := time.Parse("2006-01-02T15:04:05.99999999Z", datestr); err == nil {
return t, nil
} else if t, err := time.Parse("2006-01-02T15:04:05.9999999Z", datestr); err == nil {
return t, nil
} else if t, err := time.Parse("2006-01-02T15:04:05.999999Z", datestr); err == nil {
return t, nil
} else if t, err := time.Parse("2006-01-02T15:04:05.99999Z", datestr); err == nil {
return t, nil
} else if t, err := time.Parse("2006-01-02T15:04:05.9999Z", datestr); err == nil {
return t, nil
} else if t, err := time.Parse("2006-01-02T15:04:05.999Z", datestr); err == nil {
return t, nil
} else if t, err := time.Parse("2006-01-02T15:04:05.99Z", datestr); err == nil {
return t, nil
} else {
return time.Time{}, err
}
}
case ST_DIGITSLASH: // starts digit then slash 02/
// 2014/07/10 06:55:38.156283