<commit_before>package clock

import (
	"fmt"
)

const testVersion = 3

type Clock struct {
	h, m int
}

func New(hour, minute int) Clock {
	hour = (hour + minute/60) % 24
	minute = minute % 60
	return Clock{hour, minute}
}

func (c Clock) String() string {
	return fmt.Sprintf("%02d:%02d", c.h, c.m)
}

func (Clock) Add(minutes int) Clock {
	return Clock{1, minutes}
}<commit_msg>fix the init code to work with negative values<commit_after>package clock

import (
	"fmt"
)

const testVersion = 3

type Clock struct {
	h, m int
}

func New(hour, minute int) Clock {
	hour = (hour + minute/60) % 24
	minute = minute % 60
	if minute < 0 {
		hour--
		minute = minute + 60
	}
	if hour < 0 {
		hour = hour + 24
	}
	return Clock{hour, minute}
}

func (c Clock) String() string {
	return fmt.Sprintf("%02d:%02d", c.h, c.m)
}

func (c Clock) Add(minutes int) Clock {
	var hour = (c.h + (c.m+minutes)/60) % 24
	minutes = (minutes + c.m) % 60
	if minutes < 0 {
		hour--
		minutes = minutes + 60
	}
	if hour < 0 {
		hour = hour + 24
	}
	return Clock{hour, minutes}
}
{'fraction_non_alphanumeric': 0.14123222748815165, 'fraction_numerical': 0.03886255924170616, 'mean_word_length': 3.1411764705882352, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 3, 'https://': 0, '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': '5585291', 'n_tokens_mistral': 464, 'n_tokens_neox': 404, 'n_words': 134}