Time elixir中的utc_偏移返回不正确的时区偏移

Time elixir中的utc_偏移返回不正确的时区偏移,time,timezone,elixir,phoenix-framework,Time,Timezone,Elixir,Phoenix Framework,我可能不理解这里的某些东西,但这可以更直截了当地看 iex> {:ok, datetime_with_tz} = DateTime.now("Europe/London", Tzdata.TimeZoneDatabase) {:ok, #DateTime<2020-05-02 21:57:11.136512+01:00 BST Europe/London>} iex> DateTime.utc_now ~U[2020-05-02 20:57:21.869835Z] /

我可能不理解这里的某些东西,但这可以更直截了当地看

iex> {:ok, datetime_with_tz} = DateTime.now("Europe/London", Tzdata.TimeZoneDatabase)
{:ok, #DateTime<2020-05-02 21:57:11.136512+01:00 BST Europe/London>}

iex> DateTime.utc_now
~U[2020-05-02 20:57:21.869835Z]

//correct as it's already in utc
iex> DateTime.utc_now.utc_offset
0 

// incorrect this should be 3600 i.e +01:00 hours of offset and not 0 .. ?
iex> datetime_with_tz.utc_offset
0  

这是因为伦敦通常是UTC+00:00,目前是+01:00,因为夏令时BST代表英国夏令时

DateTime必须解决这个问题

iex(1)> {:ok, datetime_with_tz} = DateTime.now("Europe/London", Tzdata.TimeZoneDatabase) 
iex(2)> datetime_with_tz.std_offset
3600