src/Marando/AstroDate/TimeZone.php
public function offset($jd) {
    // Is DST observed for this timezone? If no, return offset as is
    if ($this->dst == false)
      return $this->offset;

    // Get YMD for provided JD and day of year number (with fractional day)
    IAU::Jd2cal($jd, 0, $y, $m, $d, $fd);
    $dayN = static::dayOfYear($y, $m, $d) + $fd;

    // DST begins at 2:00 a.m. on the second Sunday of March and...
    IAU::Cal2jd($y, 3, 1, $djm0, $djm);
    $dayB = static::dayOfYear($y, 2, 1) + 14 -
            static::weekDayNum($djm0 + $djm) + (2 / 24);

    // ...ends at 2:00 a.m. on the first Sunday of November
    IAU::Cal2jd($y, 11, 1, $djm0, $djm);
    $dayE = static::dayOfYear($y, 11, 1) + 14 -
            static::weekDayNum($djm0 + $djm) + (2 / 24);

    // Check if the given JD falls with in the DST range for that year
    if ($dayN >= $dayB && $dayN < $dayE)
      return $this->offset + 1;
    else
      return $this->offset;
  }
public function offset($jd) {
    // Is DST observed for this timezone? If no, return offset as is
    if ($this->dst == false)
      return $this->offset;

    // Get YMD for provided JD and day of year number (with fractional day)
    IAU::Jd2cal($jd, 0, $y, $m, $d, $fd);
    $dayN = static::dayOfYear($y, $m, $d) + $fd;

    // DST begins at 2:00 a.m. on the second Sunday of March and...
    IAU::Cal2jd($y, 3, 1, $djm0, $djm);
    $dayB = static::dayOfYear($y, 2, 1) + 14 -
            static::weekDayNum($djm0 + $djm) + (2 / 24);

    // ...ends at 2:00 a.m. on the first Sunday of November
    IAU::Cal2jd($y, 11, 1, $djm0, $djm);
    $dayE = static::dayOfYear($y, 11, 1) + 14 -
            static::weekDayNum($djm0 + $djm) + (2 / 24);

    // Check if the given JD falls with in the DST range for that year
    if ($dayN >= $dayB && $dayN < $dayE)
      return $this->offset + 1;
    else
      return $this->offset;
  }
Calculates the offset of this time zone for a given Julian date. Accounts
for daylight savings time if relevant and based on the date.

@param  float $jd Julian date to check for
@return float     Offset in hours including DST (if relevant)