Esempio n. 1
0
/* getWeek - 1-52 week of the year */
int getWeek(struct syslogTime *ts)
{
	int weekNum;
	struct syslogTime yt;
	int curDow;
	int jan1Dow;
	int curYearDay;

	/* initialize a timestamp for january 1st of the current year */
	yt.year = ts->year;
	yt.month = 1;
	yt.day = 1;
	yt.hour = 0;
	yt.minute = 0;
	yt.second = 0;
	yt.secfracPrecision = 0;
	yt.secfrac = 0;
	yt.OffsetMinute = ts->OffsetMinute;
	yt.OffsetHour = ts->OffsetHour;
	yt.OffsetMode = ts->OffsetMode;
	yt.timeType = TIME_TYPE_RFC3164; /* low-res time */

	/* get current day in year, current day of week
	 * and the day of week of 1/1 */
	curYearDay = getOrdinal(ts);
	curDow = getWeekdayNbr(ts);
	jan1Dow = getWeekdayNbr(&yt);

	/* calculate week of year for given date by pinning 1/1 as start
	 * of year, then going back and adjusting for the actual week day. */
	weekNum = ((curYearDay + 6) / 7);
	if (curDow < jan1Dow) {
		++weekNum;
	}
	return weekNum;
}
Esempio n. 2
0
svn_opt_revision_kind EnumMapper::toRevisionKind(jobject jkind)
{
  return static_cast<svn_opt_revision_kind>
             (getOrdinal(JAVA_PACKAGE"/types/Revision$Kind", jkind));
}
Esempio n. 3
0
svn_wc_conflict_choice_t EnumMapper::toConflictChoice(jobject jchoice)
{
  return static_cast<svn_wc_conflict_choice_t>
             (getOrdinal(JAVA_PACKAGE"/ConflictResult$Choice", jchoice));
}
Esempio n. 4
0
svn_depth_t EnumMapper::toDepth(jobject jdepth)
{
  // The offset for depths is -2
  return static_cast<svn_depth_t>(getOrdinal(JAVA_PACKAGE"/types/Depth", jdepth) - 2);
}
Esempio n. 5
0
int EnumMapper::toLogLevel(jobject jLogLevel)
{
  return getOrdinal(JAVA_PACKAGE"/SVNClient$ClientLogLevel", jLogLevel);
}
Esempio n. 6
0
int EnumMapper::toMergeinfoLogKind(jobject jLogKind)
{
  return getOrdinal(JAVA_PACKAGE"/types/Mergeinfo$LogKind", jLogKind);
}