Advertisement
pr4wn

bigben2localtime

Mar 17th, 2012
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 0.59 KB | None | 0 0
  1. #bigben2localtime
  2. use Date::Manip;
  3.  
  4. # Simply follow @big_ben_clock and this will replace the BONGS with a
  5. # localtime conversion of the tweet timestamp.
  6. # The BONGS wear a bit thin after a while and are only useful in GMT time zones.
  7. # @pr4wn
  8.  
  9. sub date_format {
  10.   my $date = shift;
  11.   my $s;
  12.  
  13.   $s = substr( $date, 8, 8 ); # hh:mm:ss
  14.  
  15.   return( $s );
  16.  
  17. }
  18.  
  19. $handle = sub {
  20.  
  21.  
  22. my $ref = shift;
  23.  
  24. if ($ref->{user}->{screen_name} eq 'big_ben_clock' ) {
  25.  
  26.   my $created_at = ParseDate($ref->{'created_at'});
  27.   $ref->{text} = date_format($created_at);
  28.  
  29. }
  30.  
  31. &defaulthandle ( $ref );
  32.  
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement