/// <summary> /// Request the Image or ImageProducer to start delivering pixels and /// wait for all of the pixels in the rectangle of interest to be /// delivered or until the specified timeout has elapsed. This method /// behaves in the following ways, depending on the value of /// <code>ms</code>: /// <ul> /// <li> If {@code ms == 0}, waits until all pixels are delivered /// <li> If {@code ms > 0}, waits until all pixels are delivered /// as timeout expires. /// <li> If {@code ms < 0}, returns <code>true</code> if all pixels /// are grabbed, <code>false</code> otherwise and does not wait. /// </ul> </summary> /// <param name="ms"> the number of milliseconds to wait for the image pixels /// to arrive before timing out </param> /// <returns> true if the pixels were successfully grabbed, false on /// abort, error or timeout </returns> /// <exception cref="InterruptedException"> /// Another thread has interrupted this thread. </exception> //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public synchronized boolean grabPixels(long ms) throws InterruptedException public virtual bool GrabPixels(long ms) { lock (this) { if ((Flags & DONEBITS) != 0) { return((Flags & GRABBEDBITS) != 0); } long end = ms + DateTimeHelperClass.CurrentUnixTimeMillis(); if (!Grabbing) { Grabbing = true; Flags &= ~(ImageObserver_Fields.ABORT); Producer.StartProduction(this); } while (Grabbing) { long timeout; if (ms == 0) { timeout = 0; } else { timeout = end - DateTimeHelperClass.CurrentUnixTimeMillis(); if (timeout <= 0) { break; } } Monitor.Wait(this, TimeSpan.FromMilliseconds(timeout)); } return((Flags & GRABBEDBITS) != 0); } }
/// <summary> /// The main timer loop. (See class comment.) /// </summary> private void MainLoop() { while (true) { try { TimerTask task; bool taskFired; lock (Queue) { // Wait for queue to become non-empty while (Queue.Empty && NewTasksMayBeScheduled) { Monitor.Wait(Queue); } if (Queue.Empty) { break; // Queue is empty and will forever remain; die } // Queue nonempty; look at first evt and do the right thing long currentTime, executionTime; task = Queue.Min; lock (task.@lock) { if (task.State == TimerTask.CANCELLED) { Queue.RemoveMin(); continue; // No action required, poll queue again } currentTime = DateTimeHelperClass.CurrentUnixTimeMillis(); executionTime = task.NextExecutionTime; if (taskFired = (executionTime <= currentTime)) { if (task.Period == 0) // Non-repeating, remove { Queue.RemoveMin(); task.State = TimerTask.EXECUTED; } // Repeating task, reschedule else { Queue.RescheduleMin(task.Period < 0 ? currentTime - task.Period : executionTime + task.Period); } } } if (!taskFired) // Task hasn't yet fired; wait { Monitor.Wait(Queue, TimeSpan.FromMilliseconds(executionTime - currentTime)); } } if (taskFired) // Task fired; run it, holding no locks { task.Run(); } } catch (InterruptedException) { } } }
private void updateCallDuration() { if (mCallStart > 0) { mCallDuration.Text = formatTimespan(DateTimeHelperClass.CurrentUnixTimeMillis() - mCallStart); } }
public virtual void run() { if (18 <= msg_count) { outerInstance.setReceiverEndTime(InterfaceName, Node, DateTimeHelperClass.CurrentUnixTimeMillis()); //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final long totalTime = getReceiverEndTime(InterfaceName, Node) - getReceiverStartTime(InterfaceName, Node); long totalTime = outerInstance.getReceiverEndTime(InterfaceName, Node) - outerInstance.getReceiverStartTime(InterfaceName, Node); //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final int loss = getReceiverLossPer(InterfaceName, Node, getTotalMsgRecvd(InterfaceName, Node)); int loss = outerInstance.getReceiverLossPer(InterfaceName, Node, outerInstance.getTotalMsgRecvd(InterfaceName, Node)); if (outerInstance.mListener != null) { outerInstance.mListener.lossCalculated(InterfaceName, Node, totalTime, loss); outerInstance.mListener.updateGrid(InterfaceName, Node, msg_count + 1); } outerInstance.StopTimer(InterfaceName, Node); outerInstance.setMessageCount(InterfaceName, Node); } else { if (outerInstance.mListener != null) { outerInstance.mListener.restart_timer(InterfaceName, Node, msg_count); } } }
public async void Initialize(string renderThemeFilePath, XmlRenderThemeMenuCallback menuCallback) { var fileExists = await FileSystem.Current.LocalStorage.CheckExistsAsync(renderThemeFilePath); if (fileExists == ExistenceCheckResult.NotFound) { throw new PCLStorage.Exceptions.FileNotFoundException("file does not exist: " + renderThemeFilePath); } else if (fileExists == ExistenceCheckResult.FolderExists) { throw new PCLStorage.Exceptions.FileNotFoundException("not a file: " + renderThemeFilePath); } // Open file this.renderThemeFile = await FileSystem.Current.LocalStorage.GetFileAsync(renderThemeFilePath); this.renderThemeFileStream = await this.renderThemeFile.OpenAsync(FileAccess.Read); this.menuCallback = menuCallback; if (this.renderThemeFileStream == null) { throw new PCLStorage.Exceptions.FileNotFoundException("cannot read file: " + renderThemeFile.Path); } // TODO: Add lastModified to PCLStorage this.lastModifiedTime = DateTimeHelperClass.CurrentUnixTimeMillis(); // renderThemeFile.lastModified(); if (this.lastModifiedTime == 0L) { throw new PCLStorage.Exceptions.FileNotFoundException("cannot read last modified time: " + renderThemeFile.Path); } }
/// <summary> /// Starts loading all images tracked by this media tracker with the /// specified identifier. This method waits until all the images with /// the specified identifier have finished loading, or until the /// length of time specified in milliseconds by the <code>ms</code> /// argument has passed. /// <para> /// If there is an error while loading or scaling an image, then that /// image is considered to have finished loading. Use the /// <code>statusID</code>, <code>isErrorID</code>, and /// <code>isErrorAny</code> methods to check for errors. /// </para> /// </summary> /// <param name="id"> the identifier of the images to check </param> /// <param name="ms"> the length of time, in milliseconds, to wait /// for the loading to complete </param> /// <seealso cref= java.awt.MediaTracker#waitForAll </seealso> /// <seealso cref= java.awt.MediaTracker#waitForID(int) </seealso> /// <seealso cref= java.awt.MediaTracker#statusID </seealso> /// <seealso cref= java.awt.MediaTracker#isErrorAny() </seealso> /// <seealso cref= java.awt.MediaTracker#isErrorID(int) </seealso> /// <exception cref="InterruptedException"> if any thread has /// interrupted this thread. </exception> //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public synchronized boolean waitForID(int id, long ms) throws InterruptedException public virtual bool WaitForID(int id, long ms) { lock (this) { long end = DateTimeHelperClass.CurrentUnixTimeMillis() + ms; bool first = true; while (true) { int status = StatusID(id, first, first); if ((status & LOADING) == 0) { return(status == COMPLETE); } first = false; long timeout; if (ms == 0) { timeout = 0; } else { timeout = end - DateTimeHelperClass.CurrentUnixTimeMillis(); if (timeout <= 0) { return(false); } } Monitor.Wait(this, TimeSpan.FromMilliseconds(timeout)); } } }
private TileInfo(string strInputFile) { try { DataInputStream dis = new DataInputStream(typeof(TileInfo).ClassLoader.getResourceAsStream(strInputFile)); sbyte currentByte; long start = DateTimeHelperClass.CurrentUnixTimeMillis(); for (int i = 0; i < N_BYTES; i++) { currentByte = dis.readByte(); if (((currentByte >> 6) & BITMASK) == SEA) { this.seaTileInfo.Set(i * 4, true); } if (((currentByte >> 4) & BITMASK) == SEA) { this.seaTileInfo.Set(i * 4 + 1, true); } if (((currentByte >> 2) & BITMASK) == SEA) { this.seaTileInfo.Set(i * 4 + 2, true); } if ((currentByte & BITMASK) == SEA) { this.seaTileInfo.Set(i * 4 + 3, true); } } LOGGER.fine("loading of tile info data took " + (DateTimeHelperClass.CurrentUnixTimeMillis() - start) + " ms"); } catch (IOException) { LOGGER.severe("error loading tile info from file " + strInputFile); } }
/// <summary> /// Schedules the specified task for execution after the specified delay. /// </summary> /// <param name="task"> task to be scheduled. </param> /// <param name="delay"> delay in milliseconds before task is to be executed. </param> /// <exception cref="IllegalArgumentException"> if <tt>delay</tt> is negative, or /// <tt>delay + System.currentTimeMillis()</tt> is negative. </exception> /// <exception cref="IllegalStateException"> if task was already scheduled or /// cancelled, timer was cancelled, or timer thread terminated. </exception> /// <exception cref="NullPointerException"> if {@code task} is null </exception> public virtual void Schedule(TimerTask task, long delay) { if (delay < 0) { throw new IllegalArgumentException("Negative delay."); } Sched(task, DateTimeHelperClass.CurrentUnixTimeMillis() + delay, 0); }
public override void onCallEstablished(Call call) { Log.d(TAG, "Call established"); outerInstance.mAudioPlayer.stopProgressTone(); outerInstance.mCallState.Text = call.State.ToString(); VolumeControlStream = AudioManager.STREAM_VOICE_CALL; outerInstance.mCallStart = DateTimeHelperClass.CurrentUnixTimeMillis(); }
/// <summary> /// Whether the tile is stale and should be refreshed. /// <para> /// This method is called from <seealso cref="#draw(BoundingBox, byte, Canvas, Point)"/> to determine whether the tile needs to /// be refreshed. /// </para> /// <para> /// A tile is considered stale if one or more of the following two conditions apply: /// <ul> /// <li>The {@code bitmap}'s <seealso cref="MapsforgeSharp.Core.Graphics.ITileBitmap#isExpired()"/> method returns {@code True}.</li> /// <li>The layer has a time-to-live (TTL) set (<seealso cref="#getCacheTimeToLive()"/> returns a nonzero value) and the sum of /// the {@code bitmap}'s <seealso cref="MapsforgeSharp.Core.Graphics.ITileBitmap#getTimestamp()"/> and TTL is less than current /// time (as returned by <seealso cref="java.lang.System#currentTimeMillis()"/>).</li> /// </ul> /// </para> /// <para> /// When a tile has become stale, the layer will first display the tile referenced by {@code bitmap} and attempt to /// obtain a fresh copy in the background. When a fresh copy becomes available, the layer will replace it and update /// the cache. If a fresh copy cannot be obtained (e.g. because the tile is obtained from an online source which /// cannot be reached), the stale tile will continue to be used until another /// {@code #draw(BoundingBox, byte, Canvas, Point)} operation requests it again. /// /// </para> /// </summary> /// <param name="tile"> /// A tile. This parameter is not used for a {@code TileDownloadLayer} and can be null. </param> /// <param name="bitmap"> /// The bitmap for {@code tile} currently held in the layer's cache. </param> protected internal override bool IsTileStale(Tile tile, ITileBitmap bitmap) { if (bitmap.Expired) { return(true); } return(cacheTimeToLive != 0 && ((bitmap.Timestamp + cacheTimeToLive) < DateTimeHelperClass.CurrentUnixTimeMillis())); }
private InvocationEvent(Object source, int id, Runnable runnable, Object notifier, Runnable listener, bool catchThrowables) : base(source, id) { this.Runnable = runnable; this.Notifier = notifier; this.Listener = listener; this.CatchExceptions = catchThrowables; this.When_Renamed = DateTimeHelperClass.CurrentUnixTimeMillis(); }
public CustomTypefaceSpan(Icon icon, Typeface type, float iconSizePx, float iconSizeRatio, int iconColor, bool rotate) { this.rotate = rotate; this.icon = icon.character().ToString(); this.type = type; this.iconSizePx = iconSizePx; this.iconSizeRatio = iconSizeRatio; this.iconColor = iconColor; this.rotationStartTime = DateTimeHelperClass.CurrentUnixTimeMillis(); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: private static boolean isPastCutoverDate(String s) throws java.text.ParseException private static bool IsPastCutoverDate(String s) { SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss", Locale.ROOT); format.TimeZone = TimeZone.GetTimeZone("UTC"); format.Lenient = false; long time = format.Parse(s.Trim()).Ticks; return(DateTimeHelperClass.CurrentUnixTimeMillis() > time); }
private MapFile() { // only to create a dummy empty file. databaseIndexCache = null; fileSize = 0; inputFile = null; mapFileHeader = null; readBuffer = null; timestamp = DateTimeHelperClass.CurrentUnixTimeMillis(); }
public override void run() { ITileBitmap bitmap = null; try { long start = 0; if (outerInstance.inShutdown) { return; } if (DEBUG_TIMING) { start = DateTimeHelperClass.CurrentUnixTimeMillis(); LOGGER.Info("ConcurrentJobs " + Interlocked.Increment(ref outerInstance.concurrentJobs)); } bitmap = outerInstance.databaseRenderer.ExecuteJob(rendererJob); if (outerInstance.inShutdown) { return; } if (!rendererJob.labelsOnly && bitmap != null) { outerInstance.tileCache.Put(rendererJob, bitmap); outerInstance.databaseRenderer.RemoveTileInProgress(rendererJob.tile); } outerInstance.layer.RequestRedraw(); if (DEBUG_TIMING) { long end = DateTimeHelperClass.CurrentUnixTimeMillis(); long te = Interlocked.Increment(ref outerInstance.totalExecutions); long tt = Interlocked.Add(ref outerInstance.totalTime, end - start); if (te % 10 == 0) { LOGGER.Info("TIMING " + Convert.ToString(te) + " " + Convert.ToString(tt / te)); } Interlocked.Decrement(ref outerInstance.concurrentJobs); } } finally { this.rendererJob.renderThemeFuture.DecrementRefCount(); outerInstance.jobQueue.Remove(rendererJob); if (bitmap != null) { bitmap.DecrementRefCount(); } } }
public virtual void handleLearningEvent(LearningEvent @event) { BackPropagation bp = (BackPropagation)@event.Source; LOG.info("Current iteration: " + bp.CurrentIteration); LOG.info("Error: " + bp.TotalNetworkError); LOG.info("Calculation time: " + (DateTimeHelperClass.CurrentUnixTimeMillis() - start) / 1000.0); // neuralNetwork.save(bp.getCurrentIteration() + "CNN_MNIST" + bp.getCurrentIteration() + ".nnet"); start = DateTimeHelperClass.CurrentUnixTimeMillis(); // NeuralNetworkEvaluationService.completeEvaluation(neuralNetwork, testSet); }
//mouse released// private void jPanel2MouseReleased(MouseEvent evt) { currentX = evt.X; currentY = evt.Y; const double SCALE = 0.1; BufferedImage bi = new BufferedImage(32, 32, BufferedImage.TYPE_BYTE_GRAY); Graphics2D grph = (Graphics2D)bi.Graphics; grph.scale(SCALE, SCALE); grph.drawImage(canvas, 0, 0, null); grph.dispose(); newPix = new double[32 * 32]; pixels = bi.getRGB(0, 0, 32, 32, pixels, 0, 32); for (int i = 0; i < pixels.Length; i++) { newPix[i] = 255 - (pixels[i] & 0xff); newPix[i] /= 255; } long start = DateTimeHelperClass.CurrentUnixTimeMillis(); network.Input = newPix; network.calculate(); Console.WriteLine("Execution time: " + (DateTimeHelperClass.CurrentUnixTimeMillis() - start) + " milliseconds"); try { ImageIO.write(bi, "png", new File("number.png")); } catch (IOException e) { Console.WriteLine(e.ToString()); Console.Write(e.StackTrace); } double[] networkOutput = network.Output; int maxNeuronIdx = Utils.maxIdx(networkOutput); ClassificationResult max = new ClassificationResult(maxNeuronIdx, networkOutput[maxNeuronIdx]); Console.WriteLine("New calculation:"); Console.WriteLine("Class: " + max.ClassIdx); Console.WriteLine("Probability: " + max.NeuronOutput); label.Text = Convert.ToString(max.ClassIdx); }
/// <summary> /// Construct a LogRecord with the given level and message values. /// <para> /// The sequence property will be initialized with a new unique value. /// These sequence values are allocated in increasing order within a VM. /// </para> /// <para> /// The millis property will be initialized to the current time. /// </para> /// <para> /// The thread ID property will be initialized with a unique ID for /// the current thread. /// </para> /// <para> /// All other properties will be initialized to "null". /// /// </para> /// </summary> /// <param name="level"> a logging level value </param> /// <param name="msg"> the raw non-localized logging message (may be null) </param> public LogRecord(Level level, String msg) { // Make sure level isn't null, by calling random method. level.GetType(); this.Level_Renamed = level; Message_Renamed = msg; // Assign a thread ID and a unique sequence number. SequenceNumber_Renamed = GlobalSequenceNumber.AndIncrement; ThreadID_Renamed = DefaultThreadID(); Millis_Renamed = DateTimeHelperClass.CurrentUnixTimeMillis(); NeedToInferCaller = true; }
/// <summary> /// Schedules the specified task for repeated <i>fixed-rate execution</i>, /// beginning after the specified delay. Subsequent executions take place /// at approximately regular intervals, separated by the specified period. /// /// <para>In fixed-rate execution, each execution is scheduled relative to the /// scheduled execution time of the initial execution. If an execution is /// delayed for any reason (such as garbage collection or other background /// activity), two or more executions will occur in rapid succession to /// "catch up." In the long run, the frequency of execution will be /// exactly the reciprocal of the specified period (assuming the system /// clock underlying <tt>Object.wait(long)</tt> is accurate). /// /// </para> /// <para>Fixed-rate execution is appropriate for recurring activities that /// are sensitive to <i>absolute</i> time, such as ringing a chime every /// hour on the hour, or running scheduled maintenance every day at a /// particular time. It is also appropriate for recurring activities /// where the total time to perform a fixed number of executions is /// important, such as a countdown timer that ticks once every second for /// ten seconds. Finally, fixed-rate execution is appropriate for /// scheduling multiple repeating timer tasks that must remain synchronized /// with respect to one another. /// /// </para> /// </summary> /// <param name="task"> task to be scheduled. </param> /// <param name="delay"> delay in milliseconds before task is to be executed. </param> /// <param name="period"> time in milliseconds between successive task executions. </param> /// <exception cref="IllegalArgumentException"> if {@code delay < 0}, or /// {@code delay + System.currentTimeMillis() < 0}, or /// {@code period <= 0} </exception> /// <exception cref="IllegalStateException"> if task was already scheduled or /// cancelled, timer was cancelled, or timer thread terminated. </exception> /// <exception cref="NullPointerException"> if {@code task} is null </exception> public virtual void ScheduleAtFixedRate(TimerTask task, long delay, long period) { if (delay < 0) { throw new IllegalArgumentException("Negative delay."); } if (period <= 0) { throw new IllegalArgumentException("Non-positive period."); } Sched(task, DateTimeHelperClass.CurrentUnixTimeMillis() + delay, period); }
public virtual void handleLearningEvent(LearningEvent @event) { BackPropagation bp = (BackPropagation)@event.Source; LOG.info("Epoch no#: [{}]. Error [{}]", bp.CurrentIteration, bp.TotalNetworkError); LOG.info("Epoch execution time: {} sec", (DateTimeHelperClass.CurrentUnixTimeMillis() - start) / 1000.0); // neuralNetwork.save(bp.getCurrentIteration() + "_MNIST_CNN-MIC.nnet"); start = DateTimeHelperClass.CurrentUnixTimeMillis(); // if (bp.getCurrentIteration() % 5 == 0) // Evaluation.runFullEvaluation(neuralNetwork, testSet); }
public override void onCallEstablished(Call call) { Log.d(TAG, "Call established"); outerInstance.mAudioPlayer.stopProgressTone(); outerInstance.mCallState.Text = call.State.ToString(); VolumeControlStream = AudioManager.STREAM_VOICE_CALL; AudioController audioController = outerInstance.SinchServiceInterface.AudioController; audioController.enableSpeaker(); outerInstance.mCallStart = DateTimeHelperClass.CurrentUnixTimeMillis(); Log.d(TAG, "Call offered video: " + call.Details.VideoOffered); }
/// <summary> /// Returns the <code>Currency</code> instance for the country of the /// given locale. The language and variant components of the locale /// are ignored. The result may vary over time, as countries change their /// currencies. For example, for the original member countries of the /// European Monetary Union, the method returns the old national currencies /// until December 31, 2001, and the Euro from January 1, 2002, local time /// of the respective countries. /// <para> /// The method returns <code>null</code> for territories that don't /// have a currency, such as Antarctica. /// /// </para> /// </summary> /// <param name="locale"> the locale for whose country a <code>Currency</code> /// instance is needed </param> /// <returns> the <code>Currency</code> instance for the country of the given /// locale, or {@code null} </returns> /// <exception cref="NullPointerException"> if <code>locale</code> or its country /// code is {@code null} </exception> /// <exception cref="IllegalArgumentException"> if the country of the given {@code locale} /// is not a supported ISO 3166 country code. </exception> public static Currency GetInstance(Locale locale) { String country = locale.Country; if (country == null) { throw new NullPointerException(); } if (country.Length() != 2) { throw new IllegalArgumentException(); } char char1 = country.CharAt(0); char char2 = country.CharAt(1); int tableEntry = GetMainTableEntry(char1, char2); if ((tableEntry & COUNTRY_TYPE_MASK) == SIMPLE_CASE_COUNTRY_MASK && tableEntry != INVALID_COUNTRY_ENTRY) { char finalChar = (char)((tableEntry & SIMPLE_CASE_COUNTRY_FINAL_CHAR_MASK) + 'A'); int defaultFractionDigits = (tableEntry & SIMPLE_CASE_COUNTRY_DEFAULT_DIGITS_MASK) >> SIMPLE_CASE_COUNTRY_DEFAULT_DIGITS_SHIFT; int numericCode = (tableEntry & NUMERIC_CODE_MASK) >> NUMERIC_CODE_SHIFT; StringBuilder sb = new StringBuilder(country); sb.Append(finalChar); return(GetInstance(sb.ToString(), defaultFractionDigits, numericCode)); } else { // special cases if (tableEntry == INVALID_COUNTRY_ENTRY) { throw new IllegalArgumentException(); } if (tableEntry == COUNTRY_WITHOUT_CURRENCY_ENTRY) { return(null); } else { int index = (tableEntry & SPECIAL_CASE_COUNTRY_INDEX_MASK) - SPECIAL_CASE_COUNTRY_INDEX_DELTA; if (ScCutOverTimes[index] == Long.MaxValue || DateTimeHelperClass.CurrentUnixTimeMillis() < ScCutOverTimes[index]) { return(GetInstance(ScOldCurrencies[index], ScOldCurrenciesDFD[index], ScOldCurrenciesNumericCode[index])); } else { return(GetInstance(ScNewCurrencies[index], ScNewCurrenciesDFD[index], ScNewCurrenciesNumericCode[index])); } } } }
internal virtual void startAnimation(double startScaleFactor, double targetScaleFactor) { // TODO this is not properly synchronized this.startScaleFactor = startScaleFactor; this.scaleDifference = targetScaleFactor - this.startScaleFactor; this.executeAnimation = true; this.timeStart = DateTimeHelperClass.CurrentUnixTimeMillis(); this.timeEnd = this.timeStart + DEFAULT_DURATION; lock (this) { Monitor.Pulse(this); } }
/// <summary> /// Report notification has been displayed. </summary> /// <param name="context"> any application context. </param> public virtual void displayNotification(Context context) { /* Update last displayed date */ mNotificationLastDisplayedDate = DateTimeHelperClass.CurrentUnixTimeMillis(); /* First date and reach feedback the first time */ if (mNotificationFirstDisplayedDate == null) { mNotificationFirstDisplayedDate = mNotificationLastDisplayedDate; mCampaignId.sendFeedBack(context, NotificationStatusPrefix + "displayed", null); } /* Notify reach agent */ EngagementReachAgent.getInstance(context).onNotificationDisplayed(this); }
protected internal override void DoWork() { if (DateTimeHelperClass.CurrentUnixTimeMillis() >= this.timeEnd) { this.executeAnimation = false; outerInstance.ScaleFactor = calculateScaleFactor(1); outerInstance.Pivot = null; } else { float timeElapsedRatio = (DateTimeHelperClass.CurrentUnixTimeMillis() - this.timeStart) / (1f * DEFAULT_DURATION); outerInstance.ScaleFactor = calculateScaleFactor(timeElapsedRatio); } Sleep(FRAME_LENGTH_IN_MS); }
private Entry EntryFor(String key) { Entry entry = Map[key]; if (entry != null) { long delta = DateTimeHelperClass.CurrentUnixTimeMillis() - entry.Timestamp(); if (delta < 0 || delta >= MillisUntilExpiration) { Map.Remove(key); entry = null; } } return(entry); }
protected internal override void onCreate(Bundle savedInstanceState) { base.onCreate(savedInstanceState); ContentView = R.layout.callscreen; mAudioPlayer = new AudioPlayer(this); mCallDuration = (TextView)findViewById(R.id.callDuration); mCallerName = (TextView)findViewById(R.id.remoteUser); mCallState = (TextView)findViewById(R.id.callState); Button endCallButton = (Button)findViewById(R.id.hangupButton); endCallButton.OnClickListener = new OnClickListenerAnonymousInnerClassHelper(this); mCallStart = DateTimeHelperClass.CurrentUnixTimeMillis(); mCallId = Intent.getStringExtra(SinchService.CALL_ID); }
private void recordVideo() { lock (this) { State = CAMERA_STATE.RECORD_VIDEO; // UI mRecordButton.Text = [email protected]_title_stop; mVideoSpinner.Enabled = false; // Start recording mMediaRecorder.start(); mRecordingStartTime = DateTimeHelperClass.CurrentUnixTimeMillis(); } }
/// <summary> /// A demonstration of how backtracking regular expressions can lead to relatively /// easy DoS attacks. /// </summary> /// <seealso cref= "http://swtch.com/~rsc/regexp/regexp1.html" </seealso> //JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Ignore public void testNastyPattern() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: public virtual void testNastyPattern() { Pattern p = Pattern.compile("(c.+)*xy"); string input = "[;<!--aecbbaa-->< febcfdc fbb = \"fbeeebff\" fc = dd >\\';<eefceceaa e= babae\" eacbaff =\"fcfaccacd\" = bcced>>>< bccaafe edb = ecfccdff\" <?</script>< edbd ebbcd=\"faacfcc\" aeca= bedbc ceeaac =adeafde aadccdaf = \"afcc ffda=aafbe �\"1843785582']"; for (int i = 0; i < input.Length; i++) { Matcher matcher = p.matcher(input.Substring(0, i)); long t = DateTimeHelperClass.CurrentUnixTimeMillis(); if (matcher.find()) { Console.WriteLine(matcher.group()); } Console.WriteLine(i + " > " + (DateTimeHelperClass.CurrentUnixTimeMillis() - t) / 1000.0); } }
public override void draw(Canvas canvas, CharSequence text, int start, int end, float x, int top, int y, int bottom, Paint paint) { applyCustomTypeFace(paint, type); paint.getTextBounds(icon, 0, 1, TEXT_BOUNDS); canvas.save(); if (rotate) { float rotation = (DateTimeHelperClass.CurrentUnixTimeMillis() - rotationStartTime) / (float)ROTATION_DURATION * 360f; float centerX = x + TEXT_BOUNDS.width() / 2f; float centerY = y - TEXT_BOUNDS.height() / 2f + TEXT_BOUNDS.height() * BASELINE_RATIO; canvas.rotate(rotation, centerX, centerY); } canvas.drawText(icon, x - TEXT_BOUNDS.left, y - TEXT_BOUNDS.bottom + TEXT_BOUNDS.height() * BASELINE_RATIO, paint); canvas.restore(); }