code: public static DateTimeValue timeFromSecsSinceEpoch(long secsSinceEpoch) {
  		// TODO: should we handle -ve years?
  		int secsInDay = (int) (secsSinceEpoch % SECS_PER_DAY);
  		int daysSinceEpoch = (int) (secsSinceEpoch / SECS_PER_DAY);
  		int approx = (int) ((daysSinceEpoch + 10) * 400L / 146097);
  		int year = (daysSinceEpoch >= fixedFromGregorian(approx + 1, 1, 1)) ? approx + 1 : approx;
  		int jan1 = fixedFromGregorian(year, 1, 1);
  		int priorDays = daysSinceEpoch - jan1;
  		int march1 = fixedFromGregorian(year, 3, 1);
  		int correction = (daysSinceEpoch < march1) ? 0 : isLeapYear(year) ? 1 : 2;
  		int month = (12 * (priorDays + correction) + 373) / 367;
  		int month1 = fixedFromGregorian(year, month, 1);
  		int day = daysSinceEpoch - month1 + 1;
  		int second = secsInDay % 60;
  		int minutesInDay = secsInDay / 60;
  		int minute = minutesInDay % 60;
  		int hour = minutesInDay / 60;
  		if (!(hour >= 0 && hour < 24)) {
  			throw new AssertionError("Input was: " + secsSinceEpoch + "to make hour: " + hour);
  		}
  		return new DateTimeValueImpl(year, month, day, hour, minute, second);
  	}
docs: Computes the gregorian time from the number of seconds since the
  Proleptic Gregorian Epoch. See "Calendrical Calculations", Reingold and
  Dershowitz.
  @param secsSinceEpoch the number of seconds since the epoch
  @return the gregorian time