You are not logged in.

#1 2019-01-02 07:24:33

makh
Member
Registered: 2011-10-10
Posts: 305

[Discussed] rtcwake - Problem with date

Hi

I tried the following to wake up laptop, after shutting down (for today and later time):

rtcwake -m no --date 2019-01-02  12:23
rtcwake: time doesn't go backward to Tue Jan  1 19:00:00 2019
rtcwake -m no --date 2019-01-04  12:23
rtcwake: wakeup using /dev/rtc0 at Thu Jan  3 19:00:00 2019

but this works:

rtcwake -m no --date  12:23
rtcwake: wakeup using /dev/rtc0 at Wed Jan  2 07:23:00 2019

Please inform; why first two with date is error?

Thankyou

Last edited by makh (2019-01-10 11:42:08)


OS:  Arch  &/  Debian
System: LENOVO ThinkPad E14
Desktop: Xfce

Offline

#2 2019-01-02 15:43:54

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,361
Website

Re: [Discussed] rtcwake - Problem with date

You are not passing time as an argument to "--date" but rather it is its own command line parameter parsed seperately.  Either quote the date-time string, or escape the space.

rtcwake -m no --date "2019-01-02  12:23"
# or
rtcwake -m no --date 2019-01-02\ 12:23

Last edited by Trilby (2019-01-02 15:44:45)


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#3 2019-01-02 19:11:28

makh
Member
Registered: 2011-10-10
Posts: 305

Re: [Discussed] rtcwake - Problem with date

Hello Sir

Thanks for your kind guidance.

But I am also having time issue:

# rtcwake -v -m no --date 2019-01-038:30 -l
Using local time.
	delta   = 17999
	tzone   = -18000
	tzname  = PKT
	systime = 1546455785, (UTC) Wed Jan  2 19:03:05 2019
	rtctime = 1546437786, (UTC) Wed Jan  2 14:03:06 2019
alarm 1546486200, sys_time 1546455785, rtc_time 1546437786, seconds 0
rtcwake: wakeup using /dev/rtc0 at Thu Jan  3 03:30:01 2019
suspend mode: no; leaving

# date
Wed Jan  2 23:59:37 PKT 2019

ie 8:30 becomes: 3:30

Looking at the example:
https://www.ostechnix.com/automatically … tion-mode/

# rtcwake -m no -l -t $(date +%s -d 'tomorrow 10:00')
rtcwake: wakeup using /dev/rtc0 at Fri Jan  4 05:00:01 2019

Trying -u is the default, and -l is also the default. I am having local time and universal time 5 hours issue.

Thankyou


OS:  Arch  &/  Debian
System: LENOVO ThinkPad E14
Desktop: Xfce

Offline

#4 2019-01-02 20:00:14

seth
Member
Registered: 2012-09-03
Posts: 63,558

Re: [Discussed] rtcwake - Problem with date

Pakistan is 5h ahead of UTC, so the gap between systime and rtctime suggests that the rtc is kept in UTC and NOT in your local time, ie. replace "-l" w/ "-u" (the default is listed in /etc/adjtime and should be UTC there)
The wakeup time is in UTC, so don't worry about that.
Fire

rtcwake -u --date +5min

and see whether the system wakes up in 5 minutes smile

Offline

#5 2019-01-02 21:12:08

progandy
Member
Registered: 2012-05-17
Posts: 5,280

Re: [Discussed] rtcwake - Problem with date

I'd suggest using neither "-u" nor "-l", but the default "-a" (--auto) option and let rtcwake read the settings from /etc/adjtime.


| alias CUTF='LANG=en_XX.UTF-8@POSIX ' |

Offline

#6 2019-01-03 12:00:51

makh
Member
Registered: 2011-10-10
Posts: 305

Re: [Discussed] rtcwake - Problem with date

seth wrote:

Pakistan is 5h ahead of UTC, so the gap between systime and rtctime suggests that the rtc is kept in UTC and NOT in your local time, ie. replace "-l" w/ "-u" (the default is listed in /etc/adjtime and should be UTC there)
The wakeup time is in UTC, so don't worry about that.
Fire

rtcwake -u --date +5min

and see whether the system wakes up in 5 minutes smile

Hello Sir!
This command gave error:

rtcwake -u --date +5min
rtcwake: wakeup from "suspend" using /dev/rtc0 at Thu Jan  3 11:58:25 2019
rtcwake: write error

But following works:

rtcwake -m no -u --date +6h
rtcwake: wakeup using /dev/rtc0 at Thu Jan  3 18:01:36 2019

... then I have to caculate the time, each time rather then give exact time!

Thankyou

Last edited by makh (2019-01-03 12:03:21)


OS:  Arch  &/  Debian
System: LENOVO ThinkPad E14
Desktop: Xfce

Offline

#7 2019-01-03 12:05:46

makh
Member
Registered: 2011-10-10
Posts: 305

Re: [Discussed] rtcwake - Problem with date

progandy wrote:

I'd suggest using neither "-u" nor "-l", but the default "-a" (--auto) option and let rtcwake read the settings from /etc/adjtime.

Hi
Nopes, it doesnt works...:

rtcwake -m no -a --date 2018-01-058:30
rtcwake: time doesn't go backward to Fri Jan  5 03:30:00 2018

I think the error is the default time rtcwake is taking only as UTC. Probably theres a bug; as the blog I quoted before informed that it should work!

Thankyou

Last edited by makh (2019-01-03 12:06:17)


OS:  Arch  &/  Debian
System: LENOVO ThinkPad E14
Desktop: Xfce

Offline

#8 2019-01-03 13:18:08

seth
Member
Registered: 2012-09-03
Posts: 63,558

Re: [Discussed] rtcwake - Problem with date

The write error is from a failure to set S1, try eg "-m mem" instead.
However if it works this way, passing the full date should work either.

Also, because the auto-mode fails: "cat /etc/adjtime" ?

Offline

#9 2019-01-03 14:09:17

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,361
Website

Re: [Discussed] rtcwake - Problem with date

I don't know it it would explain these symptoms, but your date/time strings still don't match any of the accepted formats.  I said quote or escape the space, but instead you've just removed the space making a largely nonsensical day and hour smashed together.  One of the accepted formats is with all the digits together, but then there should be no hypens or colon.  Pick one format.


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#10 2019-01-03 18:31:55

makh
Member
Registered: 2011-10-10
Posts: 305

Re: [Discussed] rtcwake - Problem with date

Hi

@Seth: Well it works ... but I am still stuck here (-u or -l have no difference!):

# rtcwake -m mem -u --date "2019-01-04  8:30"
rtcwake: wakeup from "mem" using /dev/rtc0 at Fri Jan  4 03:30:00 2019

# date
Thu Jan  3 23:30:25 PKT 2019

... should I bug report it? Do you get the same problem wrt your timezone?

@Trilby: You are right. Everything should be nice and clean!

Edit-1: I tested this in Debian. Now:
-u gets me to 3:30
and
-l takes me to 13:30

Thankyou

Last edited by makh (2019-01-03 18:45:54)


OS:  Arch  &/  Debian
System: LENOVO ThinkPad E14
Desktop: Xfce

Offline

#11 2019-01-03 20:35:08

seth
Member
Registered: 2012-09-03
Posts: 63,558

Re: [Discussed] rtcwake - Problem with date

This

rtcwake: wakeup from "mem" using /dev/rtc0 at Fri Jan  4 03:30:00 2019

is supposed to be UTC, ie. 8:30 in Pakistan.

The main question and test is whether "rtcwake -u -m mem --date +5min" sends your system to sleep and wakes it up 5 minutes later. You can also try w/ an absolute timestamp like

rtcwake -u -m mem --date "2019-01-04  1:40"

(assuming it's around 1:35 at your site)

We still lack the contents of /etc/adjtime to determine the assumed RTC default mode (utc./.local)

Offline

#12 2019-01-03 22:01:27

makh
Member
Registered: 2011-10-10
Posts: 305

Re: [Discussed] rtcwake - Problem with date

Hi

# rtcwake -u -m mem --date +5min

... works ok!

# cat /etc/adjtime
0.000000 1485340437 0.000000
1485340437
UTC
# rtcwake -u -m mem --date "2019-01-04  1:38"
rtcwake: time doesn't go backward to Thu Jan  3 20:38:00 2019

... a failure!

Thankyou


OS:  Arch  &/  Debian
System: LENOVO ThinkPad E14
Desktop: Xfce

Offline

#13 2019-01-03 22:12:08

seth
Member
Registered: 2012-09-03
Posts: 63,558

Re: [Discussed] rtcwake - Problem with date

At least when you posted this, it was about 03:00 in Pakistan (shouldn't you be asleep?) - so 1:38 was already in the past.

Your adjtime is UTC, so "-u" should not be required.

Offline

#14 2019-01-04 12:02:31

makh
Member
Registered: 2011-10-10
Posts: 305

Re: [Discussed] rtcwake - Problem with date

Hi

Any fix for?

# rtcwake -m mem -u --date "2019-01-04  8:30"
rtcwake: wakeup from "mem" using /dev/rtc0 at Fri Jan  4 03:30:00 2019

Thankyou


OS:  Arch  &/  Debian
System: LENOVO ThinkPad E14
Desktop: Xfce

Offline

#15 2019-01-04 13:29:55

seth
Member
Registered: 2012-09-03
Posts: 63,558

Re: [Discussed] rtcwake - Problem with date

What do you want to fix?
Once again: "rtcwake: wakeup from "mem" using /dev/rtc0 at Fri Jan  4 03:30:00 2019" displays the time in UTC, which is 5h behind PKT, so when you wake up at 8:30, people in Greenwich are still sleeping, because for them it's 3:30.

Offline

#16 2019-01-06 08:12:24

makh
Member
Registered: 2011-10-10
Posts: 305

Re: [Discussed] rtcwake - Problem with date

seth wrote:

What do you want to fix?
Once again: "rtcwake: wakeup from "mem" using /dev/rtc0 at Fri Jan  4 03:30:00 2019" displays the time in UTC, which is 5h behind PKT, so when you wake up at 8:30, people in Greenwich are still sleeping, because for them it's 3:30.

Hi

If I use:

rtcwake -m show

1. It displays me UTC time; which is infact very confusing!
2. It takes input time as local time but processes it to UTC.
3. The UTC parameter is not working.

Anyhow; then there is nothing to go for, from here, except contacting the developer, himself! smile ... I think so...

Thankyou


OS:  Arch  &/  Debian
System: LENOVO ThinkPad E14
Desktop: Xfce

Offline

Board footer

Powered by FluxBB