// MinTimeSignature sets the minimum time signature
// The time signature (meter) is a notational convention to
// specify how many beats are in each bar (or measure).
12334
func (ta *TrackAttributes) MinTimeSignature(timeSignature int) *TrackAttributes {
	ta.intAttributes["min_time_signature"] = timeSignature
	return ta
}
404121
func pnTime(t time.Time) C.pn_timestamp_t {
	if t.IsZero() {
		return C.pn_timestamp_t(0)
	}
	return C.pn_timestamp_t(t.UnixNano() / int64(time.Millisecond))
}
736339
func (t *SimpleTrack) TimeDuration() time.Duration {
	return time.Duration(t.Duration) * time.Millisecond
}
414693
func MinimumMedianTime(chainState *blockchain.BestState) time.Time {
	return chainState.MedianTime.Add(time.Second)
}
307647
func (m *JSONMetricRecorder) AddMetric(
	key, value string, created time.Time, labels map[string]string) (err error) {
	defer func() {
		if err != nil {
			err = &errMetricsData{err}
		}
	}()
	err = m.validateMetric(key, value)
	if err != nil {
		return errors.Trace(err)
	}
	m.lock.Lock()
	defer m.lock.Unlock()
	return errors.Trace(m.enc.Encode(jujuc.Metric{
		Key:    key,
		Value:  value,
		Time:   created,
		Labels: labels,
	}))
}
1117793
func NewTimerMetrics(statusEvery int, prefix string) *TimerMetrics {
	s := &TimerMetrics{
		statusEvery: statusEvery,
		prefix:      prefix,
	}
	if statusEvery > 0 {
		if statusEvery < 100 {
			log.Printf("Warning: use more than 100 status values for accurate percentiles (configured with %d)", statusEvery)
		}
		s.timings = make(durations, 0, statusEvery)
	}
	return s
}
279355
func (s *Scanner) readSignature() ([]byte, error) {
	var sig = make([]byte, 4)
	if _, err := io.ReadFull(s.r, sig); err != nil {
		return []byte{}, err
	}

	return sig, nil
}
93850
func MinTime(a, b time.Time) time.Time {
	if a.After(b) {
		return b
	}
	return a
}
978345
func (this *summaryMetricsSource) addLabeledIntMetric(metrics *MetricSet, metric *Metric, labels map[string]string, value *uint64) {
	if value == nil {
		glog.V(9).Infof("skipping labeled metric %s (%v) because the value was nil", metric.Name, labels)
		return
	}

	val := LabeledMetric{
		Name:   metric.Name,
		Labels: labels,
		MetricValue: MetricValue{
			ValueType:  ValueInt64,
			MetricType: metric.Type,
			IntValue:   int64(*value),
		},
	}
	metrics.LabeledMetrics = append(metrics.LabeledMetrics, val)
}
1075380
func TempoEvent(bpmF float64) *Event {
	ms := uint32(60000000 / bpmF)

	// bpm is expressed in in microseconds per MIDI quarter-note
	// This event indicates a tempo change.  Another way of putting
	// "microseconds per quarter-note" is "24ths of a microsecond per MIDI
	// clock".  Representing tempos as time per beat instead of beat per time
	// allows absolutely exact dword-term synchronization with a time-based sync
	// protocol such as SMPTE time code or MIDI time code.  This amount of
	// accuracy provided by this tempo resolution allows a four-minute piece at
	// 120 beats per minute to be accurate within 500 usec at the end of the
	// piece.  Ideally, these events should only occur where MIDI clocks would
	// be located Q this convention is intended to guarantee, or at least
	// increase the likelihood, of compatibility with other synchronization
	// devices so that a time signature/tempo map stored in this format may
	// easily be transferred to another device.
	return &Event{
		MsgType:        uint8(EventByteMap["Meta"]),
		Cmd:            uint8(MetaByteMap["Tempo"]),
		MsPerQuartNote: ms,
	}
}
821836
func Mint(c context.Context, params *MintParams) (*tokenserver.MachineTokenBody, string, error) {
	if err := params.Validate(); err != nil {
		return nil, "", err
	}
	fqdn, err := params.MachineFQDN()
	if err != nil {
		panic("impossible") // checked in Validate already
	}
	chunks := strings.SplitN(fqdn, ".", 2)
	if len(chunks) != 2 {
		panic("impossible") // checked in Validate already
	}
	cfg := domainConfig(params.Config, chunks[1])
	if cfg == nil {
		panic("impossible") // checked in Validate already
	}

	srvInfo, err := params.Signer.ServiceInfo(c)
	if err != nil {
		return nil, "", transient.Tag.Apply(err)
	}

	body := &tokenserver.MachineTokenBody{
		MachineFqdn: fqdn,
		IssuedBy:    srvInfo.ServiceAccountName,
		IssuedAt:    uint64(clock.Now(c).Unix()),
		Lifetime:    uint64(cfg.MachineTokenLifetime),
		CaId:        params.Config.UniqueId,
		CertSn:      params.Cert.SerialNumber.Uint64(), // already validated, fits uint64
	}
	signed, err := SignToken(c, params.Signer, body)
	if err != nil {
		return nil, "", err
	}
	return body, signed, nil
}
1203857
func TimestampFromSigned(s *Signed) (*SignedTimestamp, error) {
	ts := Timestamp{}
	if err := defaultSerializer.Unmarshal(*s.Signed, &ts); err != nil {
		return nil, err
	}
	if err := IsValidTimestampStructure(ts); err != nil {
		return nil, err
	}
	sigs := make([]Signature, len(s.Signatures))
	copy(sigs, s.Signatures)
	return &SignedTimestamp{
		Signatures: sigs,
		Signed:     ts,
	}, nil
}
1125191
func MinTTL(a, b time.Duration) time.Duration {
	if a == 0 {
		return b
	}
	if b == 0 {
		return a
	}
	if a < b {
		return a
	}
	return b
}
185432
func ParseSignature(sigStr []byte, curve elliptic.Curve) (*Signature, error) {
	return parseSig(sigStr, curve, false)
}
17237
func (s *RSASigner) Sign(tokenSecret, message string) (string, error) {
	digest := sha1.Sum([]byte(message))
	signature, err := rsa.SignPKCS1v15(rand.Reader, s.PrivateKey, crypto.SHA1, digest[:])
	if err != nil {
		return "", err
	}
	return base64.StdEncoding.EncodeToString(signature), nil
}
961162
func MinNonZeroTime(a, b time.Time) time.Time {
	if a.IsZero() {
		return b
	}
	if b.IsZero() {
		return a
	}
	return MinTime(a, b)
}
55846
func (s *LoadBalancerTlsCertificate) SetSignatureAlgorithm(v string) *LoadBalancerTlsCertificate {
	s.SignatureAlgorithm = &v
	return s
}