Groups | Blog | Home
all groups > dotnet general > january 2008 >

dotnet general : Why isn't there multiply operator for TimeSpan?


Israel
1/31/2008 6:07:19 AM
I've run across many situations where I want to store the time delta
as a TimeSpan (e.g. sampling interval) and then I want to skip every
3rd sample so I want to multiple the delta by the int 3 but I'm forced
to multiple the ticks by 3 and then construct a new TimeSpan with the
resultant ticks.
Marc Gravell
1/31/2008 2:16:56 PM
See here for a similar conversation:
http://groups.google.co.uk/group/microsoft.public.dotnet.languages.csharp/browse_thread/thread/828d5b8de352a113/2b3f24d5da0b1bdf

Marc

Cowboy (Gregory A. Beamer)
1/31/2008 10:40:07 PM
Most likely because a TimeSpan is a DateTime object. Although it can be
expressed as a straight number, it is not internally represented that way.
It could also be that your need was not envisioned.

--
Gregory A. Beamer
MVP, MCP: +I, SE, SD, DBA

*************************************************
| Think outside the box!
|
*************************************************
[quoted text, click to view]

Jon Skeet [C# MVP]
2/1/2008 7:06:59 AM
[quoted text, click to view]

No, a TimeSpan isn't a DateTime object, and internally it *is*
represented as a number - an Int64.

--
Jon Skeet - <skeet@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
AddThis Social Bookmark Button