How to make Time::Piece respect DST when converting localtime to UTC?
问题 I want to convert a timestamp from localtime to GMT. I have legacy code that does this "manually" with Time::Local::timelocal() and gmtime . It works, but I don't like it and wanted to use Time::Piece instead. I used this answer to do so (albeit they are converting the other way round, but I was able to replace + with - :-)). This is my code: #!/usr/bin/env perl use strict; use warnings; use Time::Local; use Time::Piece; use POSIX qw(strftime); sub local_to_utc_timelocal { my $local_ts =