Skip to content

Commit

Permalink
Add benchmark for LocalDateTime.ToLocalInstant
Browse files Browse the repository at this point in the history
This has to return a wrapper as LocalInstant is internal.
  • Loading branch information
jskeet committed Aug 18, 2017
1 parent 509ed22 commit 29ed52a
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/NodaTime.Benchmarks/NodaTimeTests/LocalDateTimeBenchmarks.cs
Expand Up @@ -147,11 +147,14 @@ public class LocalDateTimeBenchmarks
public LocalDateTime MinusMixedPeriod() => (Sample - SampleMixedPeriod);

#if !NO_INTERNALS
// [Benchmark]
// public LocalInstant ToLocalInstant()
// {
// return Sample.ToLocalInstant();
// }
[Benchmark]
public LocalInstantWrapper ToLocalInstant() => new LocalInstantWrapper(Sample.ToLocalInstant());

public struct LocalInstantWrapper
{
private readonly LocalInstant value;
internal LocalInstantWrapper(LocalInstant value) => this.value = value;
}
#endif
}
}

0 comments on commit 29ed52a

Please sign in to comment.