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
- EventLogHandle.cs
- TableLayoutSettingsTypeConverter.cs
- WebPartAuthorizationEventArgs.cs
- String.cs
- VariableQuery.cs
- EnvelopedSignatureTransform.cs
- RelationshipSet.cs
- RowBinding.cs
- DelimitedListTraceListener.cs
- ActionFrame.cs
- ByteKeyFrameCollection.cs
- SafeRsaProviderHandle.cs
- BitmapCodecInfo.cs
- ScopelessEnumAttribute.cs
- MenuItemBinding.cs
- unsafeIndexingFilterStream.cs
- Typography.cs
- SelectionHighlightInfo.cs
- IgnoreFlushAndCloseStream.cs
- ResourceProperty.cs
- XmlReader.cs
- RadioButtonList.cs
- PassportAuthentication.cs
- StringFormat.cs
- ComPersistableTypeElement.cs
- HtmlForm.cs
- MailHeaderInfo.cs
- DataReaderContainer.cs
- AnimationStorage.cs
- MSG.cs
- CodeBlockBuilder.cs
- ColorBlend.cs
- assertwrapper.cs
- HostingEnvironmentSection.cs
- DefaultTraceListener.cs
- VideoDrawing.cs
- TemplateBaseAction.cs
- AttributeCollection.cs
- DSASignatureFormatter.cs
- SettingsProviderCollection.cs
- ClipboardData.cs
- BuilderInfo.cs
- PerformanceCounterCategory.cs
- View.cs
- DockAndAnchorLayout.cs
- WebPartDescriptionCollection.cs
- RC2.cs
- TextReader.cs
- ConfigXmlSignificantWhitespace.cs
- SiteMapDataSourceView.cs
- LogLogRecord.cs
- XmlDataImplementation.cs
- MeshGeometry3D.cs
- ApplicationFileCodeDomTreeGenerator.cs
- Comparer.cs
- HttpListenerContext.cs
- StringFormat.cs
- metadatamappinghashervisitor.cs
- FormParameter.cs
- HttpSessionStateBase.cs
- Propagator.ExtentPlaceholderCreator.cs
- GrammarBuilderWildcard.cs
- IdentifierCollection.cs
- ProgressBarBrushConverter.cs
- RemoteWebConfigurationHostServer.cs
- SqlInternalConnectionTds.cs
- WebPartUserCapability.cs
- CollectionViewProxy.cs
- SqlTopReducer.cs
- BoundingRectTracker.cs
- MsdtcWrapper.cs
- x509store.cs
- ObjectView.cs
- FileLogRecordEnumerator.cs
- Canvas.cs
- RadioButton.cs
- WebServiceHandler.cs
- ParsedRoute.cs
- PropertyGridView.cs
- OdbcDataReader.cs
- WindowVisualStateTracker.cs
- AccessKeyManager.cs
- BamlResourceDeserializer.cs
- WindowsListViewSubItem.cs
- Resources.Designer.cs
- TypeDescriptionProvider.cs
- Adorner.cs
- COM2TypeInfoProcessor.cs
- CodePropertyReferenceExpression.cs
- OptimizerPatterns.cs
- DynamicHyperLink.cs
- ListInitExpression.cs
- SqlBulkCopy.cs
- ImageAnimator.cs
- Pts.cs
- EmptyElement.cs
- CustomActivityDesigner.cs
- TreeViewDesigner.cs
- RSAPKCS1KeyExchangeDeformatter.cs
- MessageEncodingBindingElement.cs