Skip to main content

You are here

Setting the time in softrtc

3 posts / 0 new
Last post
Setting the time in softrtc

I'm trying to make a "remote node" that will have its time from the softrtc. And then have a "central node" send the time over wireless. The problem I have is that I cannot seem to write to the softrtc variables. As a test I tried:
DateTime now =; now.second=22; just to see if I could write to the variables. I can not. All I get from the compiler is: Include:9: error: invalid use of member (did you forget the '&' ?) I may have forgotten a & but I do not know where to put it. This may be a very simple question, but C is very new to me.


You're running into some C++ and OO hurdles - now.second are function calls, which can only be used to access the values, not set it.

The way to do it is to construct a new DateTime object, like so:

DateTime mytime (2011, 11, 28, 23, 44, 12);

Then you can set "now" to "mytime", if that's what you want to do:

now = mytime;

Does that help?


Oh, this C++ thing is so very different from what I learned many years ago. Back then it was ASM, PLM, basic and Pascal. But then again, you are newer to old to learn.

I have not tried your code, but it looks right to me, so I will give it a try.

What I was trying to make was nodes that get the time from a central node, but will be able to do on their own, should central node, for some reason, go away.

Premium Drupal Themes by Adaptivethemes