Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set time function #95

Open
infusion opened this issue May 29, 2016 · 2 comments
Open

Set time function #95

infusion opened this issue May 29, 2016 · 2 comments

Comments

@infusion
Copy link

Hi,

could you please add a binding to stime(), which sets the system time to a provided Date object. This comes in handy on devices without a RTC, like raspberry pi or similar. I'd like to use npm's gps module, which holds Date objects of the received time and update the system time like this:

function onData(data) {
   time.stime(data.time);
}

Thanks!

@TooTallNate
Copy link
Owner

I can't find this function on OS X. Do you have a man page for this
function?

On Sun, May 29, 2016 at 5:09 AM, Robert Eisele [email protected]
wrote:

Hi,

could you please add a binding to stime(), which sets the system time to
a provided Date object. This comes in handy on devices without a RTC,
like raspberry pi or similar. I'd like to use npm's gps module, which
holds Date objects of the received time and update the system time like
this:

function onData(data) {
time.stime(data.time);
}

Thanks!


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
#95, or mute the thread
https://github.com/notifications/unsubscribe/AAEWWK1pcaTQCXpJwvRp55_mqwPdFooKks5qGYIBgaJpZM4IpRs0
.

@infusion
Copy link
Author

infusion commented May 29, 2016

Yep sure: http://linux.die.net/man/2/stime
A similar API is settimeofday: http://linux.die.net/man/2/settimeofday
But I'm not sure about OSX, I think their policy restricts changing the time.

Update: OSX has settimeofday as well: https://developer.apple.com/library/ios/documentation/System/Conceptual/ManPages_iPhoneOS/man2/settimeofday.2.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants