4

how can I programmatically set the hardware computer clock under Linux and Mac in C# with the Mono CLR?

EDIT:

I created a C# library to do this, so if everyone else need this function, grab it here:

https://github.com/mc-kay/sharp-timetools/

Community
  • 1
  • 1
NKnusperer
  • 974
  • 1
  • 11
  • 31

1 Answers1

2

You will need to use PInvoke (documentation : http://www.mono-project.com/Interop_with_Native_Libraries) the native (c/c++) functions for this. For linux the native function / struct is listed here : How Do You Programmatically Set the Hardware Clock on Linux?

Community
  • 1
  • 1
basarat
  • 261,912
  • 58
  • 460
  • 511
  • How can I find out which .so file I need to invoke (like the "fd" and "ioctl" function)? – NKnusperer Nov 28 '10 at 13:55
  • its not fd its "open" and is present in libc.so :) Check out http://stackoverflow.com/questions/2326636/identifying-which-linux-system-library-contains-a-function for finding out ioctl. All the best. Kindly mark as answered if done. – basarat Nov 28 '10 at 14:04