当前位置: 首页>>代码示例>>C#>>正文


C# TimeUnit.ToMillis方法代码示例

本文整理汇总了C#中TimeUnit.ToMillis方法的典型用法代码示例。如果您正苦于以下问题:C# TimeUnit.ToMillis方法的具体用法?C# TimeUnit.ToMillis怎么用?C# TimeUnit.ToMillis使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TimeUnit的用法示例。


在下文中一共展示了TimeUnit.ToMillis方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: RecencyBoostScorerBuilder

 public RecencyBoostScorerBuilder(string timeFacetName, float maxFactor, long from, long cutoff, TimeUnit timeunit)
 {
     _timeFacetName = timeFacetName;
     _maxFactor = maxFactor;
     _min = 1.0f;
     _max = _maxFactor + _min;
     _timeunit = timeunit;
     _cutoffInMillis = _timeunit.ToMillis(cutoff);
     _A = (_min - _max) / (((float)_cutoffInMillis) * ((float)_cutoffInMillis));
     _now = timeunit.ToMillis(from);
 }
开发者ID:yao-yi,项目名称:BoboBrowse.Net,代码行数:11,代码来源:RecencyBoostScorerBuilder.cs

示例2: Start

        /// <summary>
        /// Creates a new <see cref="ScheduledReporter"/> instance
        /// </summary>
        /// <param name="period">the amount of time between reports</param>
        /// <param name="unit">the unit of <c>period</c></param>
        public void Start(long period, TimeUnit unit)
        {

            this.threadTimer = new System.Timers.Timer { AutoReset = false, Interval = unit.ToMillis(period) };
            this.threadTimer.Elapsed += delegate
            {
                try
                {
                    report();
                }
                catch (Exception ex)
                {
                    LOG.ErrorFormat("Exception was thrown from {0}. Exception was suppressed. Exception: {1}", typeof(ScheduledReporter), ex);
                }
                threadTimer.Start();
            };
            threadTimer.Start();


        }
开发者ID:thattolleyguy,项目名称:metrics-net,代码行数:25,代码来源:ScheduledReporter.cs

示例3: GetTimeInMillis

 private long GetTimeInMillis(long time, TimeUnit timeunit)
 {
     return timeunit != null ? timeunit.ToMillis(time) : time;
 }
开发者ID:hasancelik,项目名称:hazelcast-csharp-client,代码行数:4,代码来源:ClientCountDownLatchProxy.cs

示例4: SetTimeout

 /// <summary>Sets the timeout.</summary>
 /// <remarks>
 ///     Sets the timeout.
 ///     The timeout determines the maximum lifespan of a transaction. So if a transaction is configured with a
 ///     timeout of 2 minutes, then it will automatically rollback if it hasn't committed yet.
 /// </remarks>
 /// <param name="timeout">the timeout.</param>
 /// <param name="timeUnit">the TimeUnit of the timeout.</param>
 /// <returns>the updated TransactionOptions</returns>
 /// <exception cref="System.ArgumentException">if timeout smaller or equal than 0, or timeUnit is null.</exception>
 /// <seealso cref="GetTimeoutMillis()">GetTimeoutMillis()</seealso>
 public TransactionOptions SetTimeout(long timeout, TimeUnit timeUnit)
 {
     if (timeout <= 0)
     {
         throw new ArgumentException("Timeout must be positive!");
     }
     _timeoutMillis = timeUnit.ToMillis(timeout);
     return this;
 }
开发者ID:ihsandemir,项目名称:hazelcast-csharp-client,代码行数:20,代码来源:TransactionOptions.cs

示例5: Convert

 public static long Convert(this TimeUnit timeUnit, long d, TimeUnit u)
 {
     switch (timeUnit)
     {
         case TimeUnit.NANOSECONDS:
             return u.ToNanos(d);
         case TimeUnit.MICROSECONDS:
             return u.ToMicros(d);
         case TimeUnit.MILLISECONDS:
             return u.ToMillis(d);
         case TimeUnit.SECONDS:
             return u.ToSeconds(d);
         case TimeUnit.MINUTES:
             return u.ToMinutes(d);
         case TimeUnit.HOURS:
             return u.ToHours(d);
         case TimeUnit.DAYS:
             return u.ToDays(d);
     }
     return d;
 }
开发者ID:yao-yi,项目名称:BoboBrowse.Net,代码行数:21,代码来源:TimeUnit.cs

示例6: GetTimeInMillis

 private long GetTimeInMillis(long time, TimeUnit timeunit)
 {
     return timeunit.ToMillis(time);
 }
开发者ID:ihsandemir,项目名称:hazelcast-csharp-client,代码行数:4,代码来源:ClientCountDownLatchProxy.cs

示例7: TryAcquire

 /// <exception cref="System.Exception"></exception>
 public virtual bool TryAcquire(int permits, long timeout, TimeUnit unit)
 {
     CheckNegative(permits);
     var request = SemaphoreTryAcquireCodec.EncodeRequest(name, permits, unit.ToMillis(timeout));
     return Invoke(request, m => SemaphoreTryAcquireCodec.DecodeResponse(m).response);
 }
开发者ID:hasancelik,项目名称:hazelcast-csharp-client,代码行数:7,代码来源:ClientSemaphoreProxy.cs


注:本文中的TimeUnit.ToMillis方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。