diff --git a/libse/BluRaySup/BluRaySupParser.cs b/libse/BluRaySup/BluRaySupParser.cs index 9a79a4417..bac19f7a0 100644 --- a/libse/BluRaySup/BluRaySupParser.cs +++ b/libse/BluRaySup/BluRaySupParser.cs @@ -117,8 +117,6 @@ namespace Nikse.SubtitleEdit.Core.BluRaySup /// bitmap of the decoded caption public static Bitmap DecodeImage(PcsObject pcs, IList data, List palettes) { - long ticks = DateTime.Now.Ticks; - if (pcs == null || data == null || data.Count == 0) return new Bitmap(1, 1); diff --git a/src/Controls/AudioVisualizer.cs b/src/Controls/AudioVisualizer.cs index 7f9fe8dfb..6f2e86c40 100644 --- a/src/Controls/AudioVisualizer.cs +++ b/src/Controls/AudioVisualizer.cs @@ -779,7 +779,7 @@ namespace Nikse.SubtitleEdit.Controls _firstMove = true; if (e.Button == MouseButtons.Left) { - _buttonDownTimeTicks = DateTime.Now.Ticks; + _buttonDownTimeTicks = DateTime.UtcNow.Ticks; Cursor = Cursors.VSplit; double seconds = RelativeXPositionToSeconds(e.X); @@ -1469,7 +1469,7 @@ namespace Nikse.SubtitleEdit.Controls if (e.Button == MouseButtons.Left && OnSingleClick != null) { int diff = Math.Abs(_mouseMoveStartX - e.X); - if (_mouseMoveStartX == -1 || _mouseMoveEndX == -1 || diff < 10 && TimeSpan.FromTicks(DateTime.Now.Ticks - _buttonDownTimeTicks).TotalSeconds < 0.25) + if (_mouseMoveStartX == -1 || _mouseMoveEndX == -1 || diff < 10 && TimeSpan.FromTicks(DateTime.UtcNow.Ticks - _buttonDownTimeTicks).TotalSeconds < 0.25) { if (ModifierKeys == Keys.Shift && _selectedParagraph != null) { diff --git a/src/Forms/Main.cs b/src/Forms/Main.cs index 269c54c44..527fa92bc 100644 --- a/src/Forms/Main.cs +++ b/src/Forms/Main.cs @@ -1609,10 +1609,10 @@ namespace Nikse.SubtitleEdit.Forms if (_makeHistoryPaused) return; - if ((DateTime.Now.Ticks - _lastHistoryTicks) > 10000 * 500) // only if last change was longer ago than 500 milliseconds + if ((DateTime.UtcNow.Ticks - _lastHistoryTicks) > 10000 * 500) // only if last change was longer ago than 500 milliseconds { MakeHistoryForUndo(description); - _lastHistoryTicks = DateTime.Now.Ticks; + _lastHistoryTicks = DateTime.UtcNow.Ticks; } } @@ -7106,7 +7106,7 @@ namespace Nikse.SubtitleEdit.Forms private void TextBoxListViewTextKeyDown(object sender, KeyEventArgs e) { - _listViewTextTicks = DateTime.Now.Ticks; + _listViewTextTicks = DateTime.UtcNow.Ticks; if (e.Modifiers == Keys.Shift && e.KeyCode == Keys.ShiftKey) return; if (e.Modifiers == Keys.Control && e.KeyCode == (Keys.LButton | Keys.ShiftKey)) @@ -7202,7 +7202,7 @@ namespace Nikse.SubtitleEdit.Forms } // last key down in text - _lastTextKeyDownTicks = DateTime.Now.Ticks; + _lastTextKeyDownTicks = DateTime.UtcNow.Ticks; UpdatePositionAndTotalLength(labelTextLineTotal, textBoxListViewText); } @@ -9085,7 +9085,7 @@ namespace Nikse.SubtitleEdit.Forms ShowStatus(string.Format("{0}, {1:0}%", statusMessage, _lastProgressPercent)); statusStrip1.Refresh(); TaskbarList.SetProgressValue(Handle, percent, 100); - if (DateTime.Now.Ticks % 10 == 0) + if (DateTime.UtcNow.Ticks % 10 == 0) { Application.DoEvents(); } @@ -13522,7 +13522,7 @@ namespace Nikse.SubtitleEdit.Forms int index = ShowSubtitle(); if (index != -1 && checkBoxSyncListViewWithVideoWhilePlaying.Checked && oldIndex != index) { - if ((DateTime.Now.Ticks - _lastTextKeyDownTicks) > 10000 * 700) // only if last typed char was entered > 700 milliseconds + if ((DateTime.UtcNow.Ticks - _lastTextKeyDownTicks) > 10000 * 700) // only if last typed char was entered > 700 milliseconds { if (_endSeconds <= 0 || !checkBoxAutoRepeatOn.Checked) { @@ -17280,7 +17280,7 @@ namespace Nikse.SubtitleEdit.Forms private void TextBoxListViewTextAlternateKeyDown(object sender, KeyEventArgs e) { - _listViewAlternateTextTicks = DateTime.Now.Ticks; + _listViewAlternateTextTicks = DateTime.UtcNow.Ticks; if (_subtitleAlternate == null || _subtitleAlternate.Paragraphs.Count < 1) return; @@ -17352,7 +17352,7 @@ namespace Nikse.SubtitleEdit.Forms } // last key down in text - _lastTextKeyDownTicks = DateTime.Now.Ticks; + _lastTextKeyDownTicks = DateTime.UtcNow.Ticks; UpdatePositionAndTotalLength(labelTextAlternateLineTotal, textBoxListViewTextAlternate); } @@ -18237,7 +18237,7 @@ namespace Nikse.SubtitleEdit.Forms if (_listViewTextTicks == -1 || !CanFocus || _subtitle == null || _subtitle.Paragraphs.Count == 0 || index < 0 || index >= _subtitle.Paragraphs.Count) return; - if ((DateTime.Now.Ticks - _listViewTextTicks) > 10000 * 700) // only if last typed char was entered > 700 milliseconds + if ((DateTime.UtcNow.Ticks - _listViewTextTicks) > 10000 * 700) // only if last typed char was entered > 700 milliseconds { if (index < 0 || index >= _subtitle.Paragraphs.Count) return; @@ -18304,7 +18304,7 @@ namespace Nikse.SubtitleEdit.Forms if (_listViewAlternateTextTicks == -1 || !CanFocus || _subtitleAlternate == null || _subtitleAlternate.Paragraphs.Count == 0 || index < 0 || index >= _subtitleAlternate.Paragraphs.Count) return; - if ((DateTime.Now.Ticks - _listViewAlternateTextTicks) > 10000 * 700) // only if last typed char was entered > 700 milliseconds + if ((DateTime.UtcNow.Ticks - _listViewAlternateTextTicks) > 10000 * 700) // only if last typed char was entered > 700 milliseconds { var original = Utilities.GetOriginalParagraph(index, _subtitle.Paragraphs[index], _subtitleAlternate.Paragraphs); if (original != null) @@ -20095,7 +20095,7 @@ namespace Nikse.SubtitleEdit.Forms { if (Configuration.Settings.VideoControls.WaveformFocusOnMouseEnter && audioVisualizer.WavePeaks != null && !audioVisualizer.Focused && audioVisualizer.CanFocus) { - if (Math.Abs(_lastWaveformMenuCloseTicks - DateTime.Now.Ticks) > 10000 * 500) // only if last change was longer ago than 500 milliseconds + if (Math.Abs(_lastWaveformMenuCloseTicks - DateTime.UtcNow.Ticks) > 10000 * 500) // only if last change was longer ago than 500 milliseconds { audioVisualizer.Focus(); } @@ -20266,7 +20266,7 @@ namespace Nikse.SubtitleEdit.Forms private void contextMenuStripWaveform_Closing(object sender, ToolStripDropDownClosingEventArgs e) { - _lastWaveformMenuCloseTicks = DateTime.Now.Ticks; + _lastWaveformMenuCloseTicks = DateTime.UtcNow.Ticks; } private void MenuOpened(object sender, EventArgs e)