ObjFW  Diff

Differences From Artifact [d90c31fbc5]:

  • File src/OFDate.m — part of check-in [3d16a30f41] at 2013-06-22 12:12:36 on branch trunk — Rework exceptions.

    This mostly removes the argument for the class in which the exception
    occurred. As backtraces were recently added for all platforms, the
    passed class does not give any extra information on where the exception
    occurred anymore.

    This also removes a few other arguments which were not too helpful. In
    the past, the idea was to pass as many arguments as possible so that it
    is easier to find the origin of the exception. However, as backtraces
    are a much better way to find the origin, those are not useful anymore
    and just make the exception more cumbersome to use. The rule is now to
    only pass arguments that might help in recovering from the exception or
    provide information that is otherwise not easily accessible. (user: js, size: 12626) [annotate] [blame] [check-ins using]

To Artifact [34887ea375]:


129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
	if ((tm = localtime(&seconds)) == NULL)				\
		@throw [OFOutOfRangeException exception];		\
									\
	return tm->field;
# endif
#endif

static int month_to_day_of_year[12] = {
	0,
	31,
	31 + 28,
	31 + 28 + 31,
	31 + 28 + 31 + 30,
	31 + 28 + 31 + 30 + 31,
	31 + 28 + 31 + 30 + 31 + 30,







|







129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
	if ((tm = localtime(&seconds)) == NULL)				\
		@throw [OFOutOfRangeException exception];		\
									\
	return tm->field;
# endif
#endif

static int monthToDayOfYear[12] = {
	0,
	31,
	31 + 28,
	31 + 28 + 31,
	31 + 28 + 31 + 30,
	31 + 28 + 31 + 30 + 31,
	31 + 28 + 31 + 30 + 31 + 30,
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
		if (tm.tm_mon >= 2 && (((tm.tm_year + 1900) % 4 == 0 &&
		    (tm.tm_year + 1900) % 100 != 0) ||
		    (tm.tm_year + 1900) % 400 == 0))
			_seconds += 86400;
		/* Months */
		if (tm.tm_mon < 0 || tm.tm_mon > 12)
			@throw [OFInvalidFormatException exception];
		_seconds += month_to_day_of_year[tm.tm_mon] * 86400;
		/* Days */
		_seconds += (tm.tm_mday - 1) * 86400;
		/* Hours */
		_seconds += tm.tm_hour * 3600;
		/* Minutes */
		_seconds += tm.tm_min * 60;
		/* Seconds */







|







257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
		if (tm.tm_mon >= 2 && (((tm.tm_year + 1900) % 4 == 0 &&
		    (tm.tm_year + 1900) % 100 != 0) ||
		    (tm.tm_year + 1900) % 400 == 0))
			_seconds += 86400;
		/* Months */
		if (tm.tm_mon < 0 || tm.tm_mon > 12)
			@throw [OFInvalidFormatException exception];
		_seconds += monthToDayOfYear[tm.tm_mon] * 86400;
		/* Days */
		_seconds += (tm.tm_mday - 1) * 86400;
		/* Hours */
		_seconds += tm.tm_hour * 3600;
		/* Minutes */
		_seconds += tm.tm_min * 60;
		/* Seconds */