Mercurial > hg > skillbot
comparison skillbot.pl @ 49:0fa8fe61aca1
Adding tz to !eta output, use UTC by default
author | Dominic Cleal <dominic@computerkb.co.uk> |
---|---|
date | Sat, 20 Dec 2008 12:05:49 +0000 |
parents | 31a4d4cab76f |
children | 14f0f0b0f83e |
comparison
equal
deleted
inserted
replaced
48:75b3b76a1643 | 49:0fa8fe61aca1 |
---|---|
242 my $finish = DateTime->from_epoch( | 242 my $finish = DateTime->from_epoch( |
243 epoch => $f->{skill}->finish_time, | 243 epoch => $f->{skill}->finish_time, |
244 time_zone => $f->{tz}); | 244 time_zone => $f->{tz}); |
245 | 245 |
246 $text = sprintf("Currently training %s %s ". | 246 $text = sprintf("Currently training %s %s ". |
247 "(finish in %s, %s%s)", | 247 "(finish in %s, %s %s%s)", |
248 $f->{skill}->name, $f->{skill}->level, | 248 $f->{skill}->name, $f->{skill}->level, |
249 $f->{skill}->time_remaining, | 249 $f->{skill}->time_remaining, |
250 $finish->strftime("%A %R"), $downtime) | 250 $finish->strftime("%A %R"), |
251 $finish->time_zone_short_name(), | |
252 $downtime); | |
251 } else { | 253 } else { |
252 $text = "No skill currently training"; | 254 $text = "No skill currently training"; |
253 } | 255 } |
254 | 256 |
255 $self->privmsg('#' . $config{channel}, sprintf( | 257 $self->privmsg('#' . $config{channel}, sprintf( |
420 my $nick = $3; | 422 my $nick = $3; |
421 my $tz = $4; | 423 my $tz = $4; |
422 my $c = $6; | 424 my $c = $6; |
423 | 425 |
424 if (! $frienduids{$uid}) { | 426 if (! $frienduids{$uid}) { |
427 unless (DateTime::TimeZone->is_valid_name($tz)) | |
428 { | |
429 irc_debug("Invalid timezone (%s) supplied for friend %s". | |
430 ", using UTC", $tz, $nick); | |
431 $tz = 'UTC'; | |
432 } | |
433 | |
425 my $api = WebService::EveOnline->new( { user_id => $uid, | 434 my $api = WebService::EveOnline->new( { user_id => $uid, |
426 api_key => $key } ); | 435 api_key => $key } ); |
427 | 436 |
428 my $loaded = 0; | 437 my $loaded = 0; |
429 foreach my $character ($api->characters) { | 438 foreach my $character ($api->characters) { |