setting the system time with C#.NET without using kernel32.dll

889 views Asked by At

Is there a way to set the system time in C#.NET without using kernel32.dll?

I'm on a 64 bit system and calling the set time function seems to return "false" for me.

2

There are 2 answers

2
Ruben Bartelink On

The .NET framework does not generally concern itself with low level system management concerns of this nature.

The problem here is that you cannot ask a question like this without telling us why it matters to you, so that people can properly contextualise an answer for you without having to be psychic.

Why do you need to do this? Will it be quicker? Are you worried the DLL might not be on the system :D

One way of finding out is to use Reflector (get it while it's hot) to look for the kernel32 method name- chances are whatever is wrapping it will be using P/Invoke and, unless they're paying silly buggers will just use the same name for the wrapper stub.

0
Nime Cloud On

Try to Run as administrator or disable UAC -if any-