<commit_before><?php

namespace Cron;

/**
 * Hours field.  Allows: * , / -
 */
class HoursField extends AbstractField
{
    public function isSatisfiedBy(\DateTime $date, $value)
    {
        return $this->isSatisfied($date->format('H'), $value);
    }

    public function increment(\DateTime $date, $invert = false)
    {
        // Change timezone to UTC temporarily. This will
        // allow us to go back or forwards and hour even
        // if DST will be changed between the hours.
        $timezone = $date->getTimezone();
        $date->setTimezone(new \DateTimeZone('UTC'));
        if ($invert) {
            $date->modify('-1 hour');
            $date->setTime($date->format('H'), 59);
        } else {
            $date->modify('+1 hour');
            $date->setTime($date->format('H'), 0);
        }
        $date->setTimezone($timezone);
<commit_msg>refs https://github.com/mtdowling/cron-expression/issues/76 - included minutes offset in HoursField::increments() to account for time zones that have a 30-minute offset.  PHPUnit tests pass.<commit_after><?php

namespace Cron;

/**
 * Hours field.  Allows: * , / -
 */
class HoursField extends AbstractField
{
    public function isSatisfiedBy(\DateTime $date, $value)
    {
        return $this->isSatisfied($date->format('H'), $value);
    }

    public function increment(\DateTime $date, $invert = false)
    {
        // Change timezone to UTC temporarily. This will
        // allow us to go back or forwards and hour even
        // if DST will be changed between the hours.
        $timezone = $date->getTimezone();
		$localMinutes = $date->format('i');
        $date->setTimezone(new \DateTimeZone('UTC'));
		// handle timezones with non-hour-offsets	
		$utcMinutes = $date->format('i');	
		$minDiff = $localMinutes - $utcMinutes;
        if ($invert) {
            $date->modify('-1 hour');
			$minutes = 59;
            $date->setTime($date->format('H'), 59 - $minDiff);			
        } else {
            $date->modify('+1 hour');
			$minutes = 0;
            $date->setTime($date->format('H'), 0 - $minDiff);		
        }
        $date->setTimezone($timezone);

{'fraction_non_alphanumeric': 0.15474520804114072, 'fraction_numerical': 0.007947639083683964, 'mean_word_length': 2.4294871794871793, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 27, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '777377', 'n_tokens_mistral': 683, 'n_tokens_neox': 642, 'n_words': 166}