Compare commits

..

No commits in common. "ec92b16a73464289967644e8147f9654822d8ef1" and "f0565c416833f9d25af0f6ac1601cc98d511d00d" have entirely different histories.

3 changed files with 15 additions and 23 deletions

View File

@ -20,7 +20,7 @@ pub fn cmd() cli.Command {
commands: [
cli.Command{
name: 'list'
description: 'List build logs. All date strings in the output are converted to the local timezone. Any time strings provided as input should be in the local timezone as well.'
description: 'List build logs.'
flags: [
cli.Flag{
name: 'limit'
@ -39,7 +39,7 @@ pub fn cmd() cli.Command {
},
cli.Flag{
name: 'today'
description: 'Only list logs started today.'
description: 'Only list logs started today (UTC time).'
flag: cli.FlagType.bool
},
cli.Flag{
@ -49,17 +49,17 @@ pub fn cmd() cli.Command {
},
cli.Flag{
name: 'day'
description: 'Only list logs started on this day. (format: YYYY-MM-DD)'
description: 'Only list logs started on this day. Format is YYYY-MM-DD.'
flag: cli.FlagType.string
},
cli.Flag{
name: 'before'
description: 'Only list logs started before this timestamp. (format: YYYY-MM-DD HH:mm:ss)'
description: 'Only list logs started before this timestamp. Accepts any RFC 3339 date.'
flag: cli.FlagType.string
},
cli.Flag{
name: 'after'
description: 'Only list logs started after this timestamp. (format: YYYY-MM-DD HH:mm:ss)'
description: 'Only list logs started after this timestamp. Accepts any RFC 3339 date.'
flag: cli.FlagType.string
},
]
@ -84,8 +84,6 @@ pub fn cmd() cli.Command {
filter.repo = repo_id
}
tz_offset := time.offset()
if cmd.flags.get_bool('today')? {
today := time.now()
@ -93,7 +91,7 @@ pub fn cmd() cli.Command {
year: today.year
month: today.month
day: today.day
}).add_seconds(-tz_offset)
})
filter.before = filter.after.add_days(1)
}
// The -today flag overwrites any of the other date flags.
@ -104,25 +102,21 @@ pub fn cmd() cli.Command {
if day_str != '' {
day := time.parse_rfc3339(day_str)?
day_utc := time.new_time(time.Time{
filter.after = time.new_time(time.Time{
year: day.year
month: day.month
day: day.day
}).add_seconds(-tz_offset)
})
// The extra -1 is so we also return logs that
// started at exactly midnight (filter bounds are
// exclusive). therefore, we have to request logs
// started after 23:59:59 the previous day.
filter.after = day_utc.add_seconds(-1)
filter.before = day_utc.add_days(1)
filter.before = filter.after.add_days(1)
} else {
if before_str != '' {
filter.before = time.parse(before_str)?.add_seconds(-tz_offset)
filter.before = time.parse_rfc3339(before_str)?
}
if after_str != '' {
filter.after = time.parse(after_str)?.add_seconds(-tz_offset)
filter.after = time.parse_rfc3339(after_str)?
}
}
}
@ -168,7 +162,7 @@ pub fn cmd() cli.Command {
// print_log_list prints a list of logs.
fn print_log_list(logs []BuildLog) ? {
data := logs.map([it.id.str(), it.repo_id.str(), it.start_time.local().str(),
data := logs.map([it.id.str(), it.repo_id.str(), it.start_time.str(),
it.exit_code.str()])
println(console.pretty_table(['id', 'repo', 'start time', 'exit code'], data)?)

View File

@ -83,7 +83,6 @@ pub fn (mut d DockerConn) inspect_container(id string) ?ContainerInspect {
mut data := json.decode(ContainerInspect, body)?
// The Docker engine API *should* always return UTC time.
data.state.start_time = time.parse_rfc3339(data.state.start_time_str)?
if data.state.status == 'exited' {

View File

@ -17,9 +17,8 @@ pub fn (bl &BuildLog) str() string {
mut parts := [
'id: $bl.id',
'repo id: $bl.repo_id',
'start time: $bl.start_time.local()',
'end time: $bl.end_time.local()',
'duration: ${bl.end_time - bl.start_time}',
'start time: $bl.start_time',
'end time: $bl.end_time',
'arch: $bl.arch',
'exit code: $bl.exit_code',
]