Created
March 30, 2023 22:05
-
-
Save gustavopsantos/57c2671b2166f5da7626b947549740de to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public struct Frequency | |
{ | |
private readonly long _millihertz; | |
public double Hertz => _millihertz / 1000d; | |
public TimeSpan Interval => TimeSpan.FromSeconds(1d / Hertz); | |
public Frequency(long millihertz) | |
{ | |
_millihertz = millihertz; | |
} | |
public static Frequency FromHertz(double hertz) | |
{ | |
return new Frequency((long) (hertz * 1000)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment