i need to convert a NSDate to C# ticks.
DateTime.ticks converts date to ticks starting from January 1 0001.
How can i do that? Thanks in advance.
I borrowed this code somewhere, so I'm not an author. Here it goes:
@implementation NSDate (Ticks) - (long long) ticks { double tickFactor = 10000000; long long tickValue = (long long)floor([self timeIntervalSince1970] * tickFactor) + 621355968000000000LL; return tickValue; } + (NSDate*) dateWithTicks:(long long)ticks { double tickFactor = 10000000; double seconds = (ticks - 621355968000000000LL) / tickFactor; return [NSDate dateWithTimeIntervalSince1970:seconds]; } @end
1.4m articles
1.4m replys
5 comments
57.0k users