Does an aggregation of type for a timestamp
 @param [Fixnum] type The counter type for which aggregation
   has to be done
 @param [Time] ts The time at which aggregation should happen
551481
def aggregate(type, ts)
      Octo::Enterprise.each do |enterprise|
        aggregate_baseline enterprise.id, type, ts
      end
    end
585716
public function processWhoColumns($types, & $row, $timestamp = null) {
		if ($types === 'all') $types = array_keys($this->who);
		if (!is_array($types)) $types = [$types];
		if (empty($timestamp)) $timestamp = \Format::now('timestamp');
		foreach ($types as $type) {
			if (!empty($this->who[$type])) {
				// timestamp
				$row[$this->column_prefix . $type . '_timestamp'] = $timestamp;
				// user #
				$row[$this->column_prefix . $type . '_user_id'] = \User::id();
			} else if ($type == 'optimistic_lock') {
				if ($this->optimistic_lock) {
					$row[$this->optimistic_lock_column] = $timestamp;
				}
			}
		}
	}
1176905
def is_after(self, ts):
        '''  '''
        if self.timestamp >= int(calendar.timegm(ts.timetuple())):
            return True
        return False
1147682
def countables
      key :type, Integer
      key :ts, Time
      key :uid, String

      key :count, Integer

      generate_aggregators { |ts, method|
        totype = method_names_type_counter(method)
        fromtype = get_fromtype_for_totype(totype)
        aggregate_and_create(fromtype, totype, ts)
      }
    end
1374860
def local_count(duration, type)
      aggr = {}
      Octo::Enterprise.each do |enterprise|
        args = {
            enterprise_id: enterprise.id,
            ts: duration,
            type: type
        }
        aggr[enterprise.id.to_s] = {} unless aggr.has_key?(enterprise.id.to_s)
        results = where(args)
        results_group = results.group_by { |x| x.uid }
        results_group.each do |uid, counters|
          _sum = counters.inject(0) do |sum, counter|
            sum + counter.count
          end
          aggr[enterprise.id.to_s][uid] = _sum
        end
      end
      aggr
    end
1178933
@Override
    public int compareTo(PlainTimestamp timestamp) {

        if (this.date.isAfter(timestamp.date)) {
            return 1;
        } else if (this.date.isBefore(timestamp.date)) {
            return -1;
        }

        return this.time.compareTo(timestamp.time);

    }
667017
function(type, checks) {
		var result = false;
		var list = this._trackedtypes[type];
		if (list) {
			result = !checks || this._haschecks(list, checks);
		}
		return result;
	}
87796
def _number_or_timestamp_handler(c, ctx):
    
    assert c in _DIGITS
    ctx.set_ion_type(IonType.INT)  # If this is the last digit read, this value is an Int.
    val = ctx.value
    val.append(c)
    c, self = yield
    trans = ctx.immediate_transition(self)
    while True:
        if _ends_value(c):
            trans = ctx.event_transition(IonThunkEvent, IonEventType.SCALAR,
                                         ctx.ion_type, _parse_decimal_int(ctx.value))
            if c == _SLASH:
                trans = ctx.immediate_transition(_number_slash_end_handler(c, ctx, trans))
        else:
            if c not in _DIGITS:
                trans = ctx.immediate_transition(_NUMBER_OR_TIMESTAMP_TABLE[c](c, ctx))
            else:
                val.append(c)
        c, _ = yield trans
420725
def _calc_timestamps(self, st_time, end_time):
        
        # calculate based on minutes
        # I have to convert the object to DateTime because of how Dynamo
        # works: https://github.com/DynamoDS/Dynamo/issues/6683
        # Do not modify this line to datetime
        curr = datetime(st_time.year, st_time.month, st_time.day, st_time.hour,
                        st_time.minute, self.is_leap_year)
        end_time = datetime(end_time.year, end_time.month, end_time.day,
                            end_time.hour, end_time.minute, self.is_leap_year)

        while curr <= end_time:
            if self.is_possible_hour(curr.hour + (curr.minute / 60.0)):
                time = DateTime(curr.month, curr.day, curr.hour, curr.minute,
                                self.is_leap_year)
                self._timestamps_data.append(time.moy)
            curr += self.minute_intervals

        if self.timestep != 1 and curr.hour == 23 and self.is_possible_hour(0):
            # This is for cases that timestep is more than one
            # and last hour of the day is part of the calculation
            curr = end_time
            for i in list(xrange(self.timestep))[1:]:
                curr += self.minute_intervals
                time = DateTime(curr.month, curr.day, curr.hour, curr.minute,
                                self.is_leap_year)
                self._timestamps_data.append(time.moy)
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')
1206925
private void checkAndUpdate(DurationFieldType type, int[] values, int newValue) {
        int index = indexOf(type);
        if (index == -1) {
            if (newValue != 0) {
                throw new IllegalArgumentException(
                    "Period does not support field '" + type.getName() + "'");
            }
        } else {
            values[index] = newValue;
        }
    }
77633
static void checkNegativeLS(
        long posixTime,
        PlainTimestamp ts
    ) {

        LeapSeconds ls = LeapSeconds.getInstance();

        if (
            ls.supportsNegativeLS()
            && (ls.strip(ls.enhance(posixTime)) > posixTime)
        ) {
            throw new ChronoException(
                "Illegal local timestamp due to "
                + "negative leap second: " + ts);
        }

    }
446725
def _is_type_compatible(a, b):
    """"""
    is_ts_compat = lambda x: isinstance(x, (Timestamp, DateOffset))
    is_td_compat = lambda x: isinstance(x, (Timedelta, DateOffset))
    return ((is_number(a) and is_number(b)) or
            (is_ts_compat(a) and is_ts_compat(b)) or
            (is_td_compat(a) and is_td_compat(b)) or
            com._any_none(a, b))
758791
def current_ts?(time)
      (current_version.time <= time) &&
        (next_version.nil? || (next_version.time < time))
    end
939952
def update_counter(period_type)
      column_from, column_to = self.class.columns_to_shift(period_type)
      return unless column_from && column_to

      self.update_attributes({
        column_to => self[column_from],
        column_from => 0
      })
    end
724001
def timestamp_compare(instance):
    
    compares = [('modified', 'ge', 'created')]
    additional_compares = enums.TIMESTAMP_COMPARE.get(instance.get('type', ''), [])
    compares.extend(additional_compares)

    for first, op, second in compares:
        comp = getattr(operator, op)
        comp_str = get_comparison_string(op)

        if first in instance and second in instance and \
                not comp(instance[first], instance[second]):
            msg = "'%s' (%s) must be %s '%s' (%s)"
            yield JSONError(msg % (first, instance[first], comp_str, second, instance[second]),
                            instance['id'])
1370102
def __access(self, ts):
    
    with self.connection:
      self.connection.execute("INSERT OR REPLACE INTO access_timestamp (timestamp, domain) VALUES (?, ?)",
                              (ts, self.domain))