Code:
/ WCF / WCF / 3.5.30729.1 / untmp / Orcas / SP / ndp / cdf / src / WCF / ServiceModel / System / ServiceModel / Channels / Ticks.cs / 1 / Ticks.cs
//---------------------------------------------------------------------------- // Copyright (c) Microsoft Corporation. All rights reserved. //--------------------------------------------------------------------------- using System.Security; namespace System.ServiceModel.Channels { static class Ticks { public static long Now { ////// Critical - makes a native method call /// Safe - SafeNativeMethod /// [SecurityCritical, SecurityTreatAsSafe] get { long time; #pragma warning suppress 56523 // [....], function has no error return value SafeNativeMethods.GetSystemTimeAsFileTime(out time); return time; } } public static long FromMilliseconds(int milliseconds) { return checked ((long)milliseconds * TimeSpan.TicksPerMillisecond); } public static int ToMilliseconds(long ticks) { return checked((int) (ticks / TimeSpan.TicksPerMillisecond)); } public static long FromTimeSpan(TimeSpan duration) { return duration.Ticks; } public static TimeSpan ToTimeSpan(long ticks) { return new TimeSpan(ticks); } public static long Add(long firstTicks, long secondTicks) { if (firstTicks == long.MaxValue || firstTicks == long.MinValue) { return firstTicks; } if (secondTicks == long.MaxValue || secondTicks == long.MinValue) { return secondTicks; } if (firstTicks >= 0 && long.MaxValue - firstTicks <= secondTicks) { return long.MaxValue - 1; } if (firstTicks <= 0 && long.MinValue - firstTicks >= secondTicks) { return long.MinValue + 1; } return checked(firstTicks + secondTicks); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- GridViewCommandEventArgs.cs
- HandlerBase.cs
- GenericQueueSurrogate.cs
- EncoderParameter.cs
- HtmlToClrEventProxy.cs
- TextDecorationUnitValidation.cs
- ILGenerator.cs
- BindingSource.cs
- Simplifier.cs
- TypeValidationEventArgs.cs
- BaseValidator.cs
- Button.cs
- ReservationCollection.cs
- RowTypePropertyElement.cs
- NavigationPropertyEmitter.cs
- TypedTableBase.cs
- StyleSelector.cs
- LeafCellTreeNode.cs
- WebPartDeleteVerb.cs
- GetPageCompletedEventArgs.cs
- GroupLabel.cs
- EntityContainerAssociationSetEnd.cs
- WebEvents.cs
- UncommonField.cs
- AggregateNode.cs
- RemoteDebugger.cs
- TimersDescriptionAttribute.cs
- DBPropSet.cs
- QueryPageSettingsEventArgs.cs
- SlipBehavior.cs
- ColorConverter.cs
- SpeakInfo.cs
- ManagedFilter.cs
- WebBrowserContainer.cs
- Single.cs
- AndCondition.cs
- DynamicValueConverter.cs
- TableParaClient.cs
- xml.cs
- ArraySubsetEnumerator.cs
- BindingMemberInfo.cs
- FixedPageStructure.cs
- SecurityTokenProvider.cs
- SafeLocalAllocation.cs
- MethodBuilderInstantiation.cs
- Button.cs
- SudsWriter.cs
- SystemResourceHost.cs
- XmlSchemaObjectTable.cs
- RemotingException.cs
- TemplateBuilder.cs
- KnownColorTable.cs
- MetadataSerializer.cs
- StaticResourceExtension.cs
- ContractMapping.cs
- AdRotator.cs
- ManagementEventWatcher.cs
- TreeSet.cs
- ControlPropertyNameConverter.cs
- ContextMenu.cs
- DecimalConstantAttribute.cs
- ConfigurationElement.cs
- DataGridViewCellMouseEventArgs.cs
- DefaultClaimSet.cs
- StylusButtonEventArgs.cs
- EmptyWithCancelationCheckWorkItem.cs
- XmlAggregates.cs
- ViewCellSlot.cs
- ToolStripPanelDesigner.cs
- PolygonHotSpot.cs
- HtmlDocument.cs
- PropertyPathConverter.cs
- ParserStreamGeometryContext.cs
- UIElementPropertyUndoUnit.cs
- MenuAutomationPeer.cs
- DocumentViewerAutomationPeer.cs
- DelegateTypeInfo.cs
- OleDbStruct.cs
- ToolBarButtonClickEvent.cs
- KeyMatchBuilder.cs
- CorrelationToken.cs
- SiteMapDesignerDataSourceView.cs
- CustomWebEventKey.cs
- PolicyValidationException.cs
- NetSectionGroup.cs
- XamlRtfConverter.cs
- UDPClient.cs
- HostingPreferredMapPath.cs
- HttpCapabilitiesSectionHandler.cs
- UpWmlPageAdapter.cs
- RemoteWebConfigurationHostServer.cs
- SQLInt64Storage.cs
- UIElementPropertyUndoUnit.cs
- Debug.cs
- GridSplitter.cs
- WindowExtensionMethods.cs
- Accessible.cs
- AdRotator.cs
- TemplateNameScope.cs
- ArraySet.cs