Returns time of execution of callable, converted to {@code TimeUnit}.

@param timeUnit of execution time.
@return
421918
public long getExecutionTime(TimeUnit timeUnit) {
        if (!ended) {
            throw new SystemException("Can't return execution time if Stopwatch wasn't started");
        }
        return timeUnit.convert(nanosEnd - nanosStart, TimeUnit.NANOSECONDS);
    }
107944
public static <T> com.simiacryptus.util.lang.TimedResult<T> time(@javax.annotation.Nonnull final UncheckedSupplier<T> fn) {
    long priorGcMs = ManagementFactory.getGarbageCollectorMXBeans().stream().mapToLong(x -> x.getCollectionTime()).sum();
    final long start = System.nanoTime();
    @Nullable T result = null;
    try {
      result = fn.get();
    } catch (@javax.annotation.Nonnull final RuntimeException e) {
      throw e;
    } catch (@javax.annotation.Nonnull final Exception e) {
      throw new RuntimeException(e);
    }
    long wallClockTime = System.nanoTime() - start;
    long gcTime = ManagementFactory.getGarbageCollectorMXBeans().stream().mapToLong(x -> x.getCollectionTime()).sum() - priorGcMs;
    return new com.simiacryptus.util.lang.TimedResult<T>(result, wallClockTime, gcTime);
  }
441771
public final EventFilterParser.time_string_function_return time_string_function() throws RecognitionException {
        EventFilterParser.time_string_function_return retval = new EventFilterParser.time_string_function_return();
        retval.start = input.LT(1);


        CommonTree root_0 = null;

        Token TIME_STRING_FUN_NAME101=null;
        Token char_literal102=null;
        Token STRING103=null;
        Token char_literal104=null;
        Token STRING105=null;
        Token char_literal106=null;
        Token STRING107=null;
        Token char_literal108=null;

        CommonTree TIME_STRING_FUN_NAME101_tree=null;
        CommonTree char_literal102_tree=null;
        CommonTree STRING103_tree=null;
        CommonTree char_literal104_tree=null;
        CommonTree STRING105_tree=null;
        CommonTree char_literal106_tree=null;
        CommonTree STRING107_tree=null;
        CommonTree char_literal108_tree=null;
        RewriteRuleTokenStream stream_35=new RewriteRuleTokenStream(adaptor,"token 35");
        RewriteRuleTokenStream stream_TIME_STRING_FUN_NAME=new RewriteRuleTokenStream(adaptor,"token TIME_STRING_FUN_NAME");
        RewriteRuleTokenStream stream_33=new RewriteRuleTokenStream(adaptor,"token 33");
        RewriteRuleTokenStream stream_34=new RewriteRuleTokenStream(adaptor,"token 34");
        RewriteRuleTokenStream stream_STRING=new RewriteRuleTokenStream(adaptor,"token STRING");

        try {
            // EventFilter.g:194:2: ( TIME_STRING_FUN_NAME '(' STRING ',' STRING ',' STRING ')' -> ^( TIME_STRING_FUN_NAME STRING STRING STRING ) )
            // EventFilter.g:194:5: TIME_STRING_FUN_NAME '(' STRING ',' STRING ',' STRING ')'
            {
            TIME_STRING_FUN_NAME101=(Token)match(input,TIME_STRING_FUN_NAME,FOLLOW_TIME_STRING_FUN_NAME_in_time_string_function1179);  
            stream_TIME_STRING_FUN_NAME.add(TIME_STRING_FUN_NAME101);


            char_literal102=(Token)match(input,33,FOLLOW_33_in_time_string_function1181);  
            stream_33.add(char_literal102);


            STRING103=(Token)match(input,STRING,FOLLOW_STRING_in_time_string_function1183);  
            stream_STRING.add(STRING103);


            char_literal104=(Token)match(input,35,FOLLOW_35_in_time_string_function1185);  
            stream_35.add(char_literal104);


            STRING105=(Token)match(input,STRING,FOLLOW_STRING_in_time_string_function1187);  
            stream_STRING.add(STRING105);


            char_literal106=(Token)match(input,35,FOLLOW_35_in_time_string_function1189);  
            stream_35.add(char_literal106);


            STRING107=(Token)match(input,STRING,FOLLOW_STRING_in_time_string_function1191);  
            stream_STRING.add(STRING107);


            char_literal108=(Token)match(input,34,FOLLOW_34_in_time_string_function1193);  
            stream_34.add(char_literal108);


            // AST REWRITE
            // elements: STRING, TIME_STRING_FUN_NAME, STRING, STRING
            // token labels: 
            // rule labels: retval
            // token list labels: 
            // rule list labels: 
            // wildcard labels: 
            retval.tree = root_0;
            RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.tree:null);

            root_0 = (CommonTree)adaptor.nil();
            // 194:63: -> ^( TIME_STRING_FUN_NAME STRING STRING STRING )
            {
                // EventFilter.g:194:66: ^( TIME_STRING_FUN_NAME STRING STRING STRING )
                {
                CommonTree root_1 = (CommonTree)adaptor.nil();
                root_1 = (CommonTree)adaptor.becomeRoot(
                new TimeStringValueTreeNode(stream_TIME_STRING_FUN_NAME.nextToken())
                , root_1);

                adaptor.addChild(root_1, 
                new StringTreeNode(stream_STRING.nextToken())
                );

                adaptor.addChild(root_1, 
                new StringTreeNode(stream_STRING.nextToken())
                );

                adaptor.addChild(root_1, 
                new StringTreeNode(stream_STRING.nextToken())
                );

                adaptor.addChild(root_0, root_1);
                }

            }


            retval.tree = root_0;

            }

            retval.stop = input.LT(-1);


            retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }

        finally {
        	// do for sure before leaving
        }
        return retval;
    }
1016686
@Pure
	public static double fromSeconds(double value, TimeUnit outputUnit) {
		switch (outputUnit) {
		case DAYS:
			return value / 86400.;
		case HOURS:
			return value / 3600.;
		case MINUTES:
			return value / 60.;
		case SECONDS:
			break;
		case MILLISECONDS:
			return unit2milli(value);
		case MICROSECONDS:
			return unit2micro(value);
		case NANOSECONDS:
			return unit2nano(value);
		default:
			throw new IllegalArgumentException();
		}
		return value;
	}
327067
public QueueBuilder<T>  finalFlushTime(int time, TimeUnit unit)
    {
        finalFlushMs = (int)unit.toMillis(time);
        return this;
    }
898325
public static <V> Predicate<TaskContext<V>> afterDelay(long time, TimeUnit timeUnit) {
        return ctx -> (System.currentTimeMillis() - ctx.getStartTime()) >= timeUnit.toMillis(time);
    }
444969
public static final BigInteger printWorkUnits(TimeUnit value)
   {
      int result;

      if (value == null)
      {
         value = TimeUnit.HOURS;
      }

      switch (value)
      {
         case MINUTES:
         {
            result = 1;
            break;
         }

         case DAYS:
         {
            result = 3;
            break;
         }

         case WEEKS:
         {
            result = 4;
            break;
         }

         case MONTHS:
         {
            result = 5;
            break;
         }

         case YEARS:
         {
            result = 7;
            break;
         }

         default:
         case HOURS:
         {
            result = 2;
            break;
         }
      }

      return (BigInteger.valueOf(result));
   }
277131
public double convert(double time, TimeUnit from, TimeUnit to) {
        return time * factorOf(to) / factorOf(from);
    }
936975
public double getAverageRequestDuration(String intervalName, TimeUnit unit) {
		return unit.transformNanos(totalTime.getValueAsLong(intervalName)) / totalRequests.getValueAsDouble(intervalName);
	}
182983
@Override public final long getDelay( TimeUnit unit ) {
    long delay = (_started+_retry)-System.currentTimeMillis();
    return unit.convert( delay, TimeUnit.MILLISECONDS );
  }
171950
public void getTimeOid (String arg1, TimeBaseService.GotTimeBaseListener arg2)
    {
        TimeBaseMarshaller.GotTimeBaseMarshaller listener2 = new TimeBaseMarshaller.GotTimeBaseMarshaller();
        listener2.listener = arg2;
        sendRequest(GET_TIME_OID, new Object[] {
            arg1, listener2
        });
    }
508519
public DurationRule maxAge(long maxAge, TimeUnit timeUnit) {
    return maxAge(Duration.ofNanos(TimeUnit.NANOSECONDS.convert(maxAge, timeUnit)));
  }
1245356
@Override
    public T waitTime(long time, TimeUnit unit) {
        return perform(new WaitTimeInteraction(new Duration(time, unit)));
    }
1189056
public static Double internalToTime(TimeUnit unit, long internalTime)
	{
		return Math.round(internalTime * TimeUnit.nanosecond.getValue()
				/ unit.getValue() * PRECISION)
				/ PRECISION;
	}
1157904
public Retryer<R> timeout(long duration, TimeUnit timeUnit) {
        return timeout(duration, timeUnit, null);
    }
1350652
public long getDuration(TimeUnit targetUnit) {
        if (isRunning()) {
            throw new IllegalStateException("The clock is not yet stopped.");
        }
        return targetUnit.convert(durationNanos, TimeUnit.NANOSECONDS);
    }
1118672
public Map<String, T> get(long to, TimeUnit unit)
    throws InterruptedException, ExecutionException, TimeoutException {
    Collection<Operation> timedoutOps = new HashSet<Operation>();
    Map<String, T> ret = internalGet(to, unit, timedoutOps);
    if (timedoutOps.size() > 0) {
      this.timeout = true;
      throw new CheckedOperationTimeoutException("Operation timed out.",
          timedoutOps);
    }
    return ret;
  }