There is a native method from dll written in c which takes a parameter of type time_t. Is it possible to use C# uint or ulong for this parameter?
I do not think I should say they are equivalent, but you can convert t_time
to DateTime
in such a way:
int t= 1070390676; // value of time_t in an ordinary integer
System.DateTime dt= new System.DateTime(1970,1,1).AddSeconds(t);
And this example is from How can I convert date-time data in time_t to C# DateTime class format?
I should also say that UInt32
is used for t_time
,too.check DateTime to time_t
Depends on how time_t
was defined in the Standard C header files the DLL was compiled against.
If time_t
is 64-bit, the C# equivalent is long
.
If time_t
is 32-bit, then it has the Year 2038 bug and you should ask whoever wrote the DLL for a non-buggy version.
According to Wikipedia's article on Time_t you could use a integer (Int32 or Int64)
Unix and POSIX-compliant systems implement time_t
as an integer or real-floating type (typically a 32- or 64-bit integer) which represents the number of seconds since the start of the Unix epoch: midnight UTC of January 1, 1970 (not counting leap seconds).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With