Adds a year to the syslog timestamp because syslog doesn't use years

        :param ts: The timestamp to add a year to
        :return: Date/time string that includes a year
425634
def _to_epoch(self, ts):
        

        year = self.year
        tmpts = "%s %s" % (ts, str(self.year))
        new_time = int(calendar.timegm(time.strptime(tmpts, "%b %d %H:%M:%S %Y")))

        # If adding the year puts it in the future, this log must be from last year
        if new_time > int(time.time()):
            year -= 1
            tmpts = "%s %s" % (ts, str(year))
            new_time = int(calendar.timegm(time.strptime(tmpts, "%b %d %H:%M:%S %Y")))

        return new_time
669474
def time_seconds(tc_array, year):
    
    tc_array = np.array(tc_array, copy=True)
    word = tc_array[:, 0]
    day = word >> 1
    word = tc_array[:, 1].astype(np.uint64)
    msecs = ((127) & word) * 1024
    word = tc_array[:, 2]
    msecs += word & 1023
    msecs *= 1024
    word = tc_array[:, 3]
    msecs += word & 1023
    return (np.datetime64(
        str(year) + '-01-01T00:00:00Z', 's') +
        msecs[:].astype('timedelta64[ms]') +
        (day - 1)[:].astype('timedelta64[D]'))
1310880
def since(self, ts):
        
        while True:
            items = super(TailingOplog, self).since(ts)
            for doc in items:
                yield doc
                ts = doc['ts']
215176
@Override
    public Temporal addTo(Temporal temporal) {
        validateChrono(temporal);
        if (months == 0) {
            if (years != 0) {
                temporal = temporal.plus(years, YEARS);
            }
        } else {
            long monthRange = monthRange();
            if (monthRange > 0) {
                temporal = temporal.plus(years * monthRange + months, MONTHS);
            } else {
                if (years != 0) {
                    temporal = temporal.plus(years, YEARS);
                }
                temporal = temporal.plus(months, MONTHS);
            }
        }
        if (days != 0) {
            temporal = temporal.plus(days, DAYS);
        }
        return temporal;
    }
953997
public static function addMonth($ts = null, $num = 1)
	{
		return sfTime::add($ts, $num, sfTime::MONTH);
	}
92274
def year(self, value=None):
        
        if value is None:
            return self.day() / 365
        else:
            self.millisecond(self.day(value * 365))
1163901
function year(options) {
    var content = ''
      , y = this.year;

    while(++y < this.max_year) {
      content += options.fn({
        year: y,
        selected: +this.expiration_year === y ? ' selected' : '',
      });
    }

    return content;
  }
30577
def _strftime(pattern, time_struct=time.localtime()):
    
    try:
        return time.strftime(pattern, time_struct)
    except OSError:
        dt = datetime.datetime.fromtimestamp(_mktime(time_struct))
        # This is incredibly hacky and will probably break with leap
        # year overlaps and shit. Any complaints should go here:
        # https://support.microsoft.com/
        original = dt.year
        current = datetime.datetime.now().year
        dt = dt.replace(year=current)
        ts = dt.timestamp()
        if _isdst(dt):
            ts -= 3600
        string = time.strftime(pattern, time.localtime(ts))
        string = string.replace(str(current), str(original))
        return string
370863
public static function addSecond($ts = null, $num = 1)
	{
		return sfTime::add($ts, $num, sfTime::SECOND);
	}
270109
public function set_timestamp($ts = null)
    {
        if (!is_numeric($ts)) {
            $this->time = null;
            $this->adate = null;
            return $this;
        }
        
        $old_year = ($this->time == null) ? false : $this->adate['year'];
        
        $this->time = $ts;
        $this->adate = getdate($ts);
        
        $this->adate['daysInMonth'] = date('t', $ts);
        
        //Test si on doit recalculer les jours fériés
        if ($old_year === false || $old_year != $this->adate['year']) {
            $this->set_joursferies($this->adate['year']);
        }
        
        return $this;
    }
406485
def absdatetime(ts, default=None):
    """"""
    if ts is None:
        ts = default
    if isinstance(ts, dict):
        ts = timedelta(**ts)
    if isinstance(ts, timedelta):
        ts = now() + ts
    if isinstance(ts, datetime):
        return ts
    return None
847180
def save(self, ts):
        
        with open(self, 'w') as f:
            Timestamp.wrap(ts).dump(f)
419436
def _get_timestamp_tuple(ts):
    
    if isinstance(ts, datetime.datetime):    
        return Timestamp.from_datetime(ts).tuple()
    elif isinstance(ts, Timestamp):    
        return ts
    raise TypeError('Timestamp or datetime.datetime required')
793592
function log(msg) {
  var d = new Date(), ts;
  ts = d.toLocaleTimeString().split(' ');
  ts = ts[0] + '.' + d.getMilliseconds() + ' ' + ts[1];
  
  console.log('[' + ts + '] ' + msg);
}
165144
public static function isOnSameDayOfYear($ts1 = 0, $ts2 = 0, $tz = null) {
		if (!Util::isValidTimezone($tz)) {
			$tz = Util::getClientTimezone();
		}
		
		$dt1 = new DateTime(null, new DateTimeZone($tz));
		$dt2 = new DateTime(null, new DateTimeZone($tz));
		return $dt1->setTimestamp($ts1)->format('m-j') == $dt2->setTimestamp($ts2)->format('m-j');
	}
91973
def parse_ts(ts):
    
    # ISO8601 = '%Y-%m-%dT%H:%M:%SZ'
    # ISO8601_MS = '%Y-%m-%dT%H:%M:%S.%fZ'
    # RFC1123 = '%a, %d %b %Y %H:%M:%S %Z'
    dt = maya.parse(ts.strip())
    return dt.datetime(naive=True)
53905
def year(date):
    
    try:
        fmt = '%m/%d/%Y'
        return datetime.strptime(date, fmt).timetuple().tm_year
    except ValueError:
        return 0