Opened 8 years ago

Closed 7 years ago

Last modified 4 years ago

#6921 closed defect (fixed)

luci_fixtime startup script does not set time

Reported by: gravydish@… Owned by: jow
Priority: normal Milestone: Backfire 10.03
Component: base system Version: Backfire 10.03 Beta
Keywords: time sync Cc:


It seems that the busybox configured in the new backfire (at least on x86) does not support the standard unix date format of %m%d%H%M%Y:

root@OpenWrt:~# date --help
BusyBox v1.15.3 (2010-03-02 07:46:01 UTC) multi-call binary

Usage: date [OPTIONS] [+FMT] [TIME]

Display time (using +FMT), or set time

	[-s] TIME	Set time to TIME
	-u		Work in UTC (don't convert to local time)
	-R		Output RFC-822 compliant date string
	-I[SPEC]	Output ISO-8601 compliant date string
			SPEC='date' (default) for date only,
			'hours', 'minutes', or 'seconds' for date and
			time to the indicated precision
	-r FILE		Display last modification time of FILE
	-d TIME		Display TIME, not 'now'
	-D FMT		Use FMT for -d TIME conversion

Recognized formats for TIME:
	YYYY-MM-DD hh:mm[:ss]

The format specified in luci_fixtime should be changed to %Y%m%d%H%M[%S].

Also, it would be nice if the luci_fixtime would also save the time of the machine before shutting down by setting the mtime of the /etc/init.d/luci_fixtime. This would be a cheap way of getting the system time closer to current time until an NTP sync is successful.

I'll attach a fixed luci_fixtime script

Attachments (1)

luci_fixtime (323 bytes) - added by gravydish@… 8 years ago.
Working luci_fixtime script (also save system time at shutdown)

Download all attachments as: .zip

Change History (7)

Changed 8 years ago by gravydish@…

Working luci_fixtime script (also save system time at shutdown)

comment:1 Changed 8 years ago by thepeople

  • Owner changed from developers to jow
  • Status changed from new to assigned

comment:2 Changed 8 years ago by jow

  • Resolution set to fixed
  • Status changed from assigned to closed

comment:3 Changed 7 years ago by Heinz Ulrich Stille <hus@…>

  • Resolution fixed deleted
  • Status changed from closed to reopened

The reference time doesn't work for my Buffalo WZR-HP-G300NH - apparently the burned in date is too new. Why not use the file's timestamp here? Replacing 1000000000 with luci.fs.mtime("/etc/init.d/luci_fixtime") fixes my problem.

comment:4 Changed 7 years ago by jow

  • Status changed from reopened to assigned

comment:5 Changed 7 years ago by jow

  • Resolution set to fixed
  • Status changed from assigned to closed

Your suggestion got implemented with

comment:6 Changed 4 years ago by…

Why not do something like

date -s `date '+%Y%m%d%H%M' -r /etc/init.d/luci_fixtime`

to get the "default" time? Doesn't need Lua at all...

Also, /etc/init.d/luci_fixtime seems to be at 2011 for me, and /etc/init.d is more often up-to-date with respect to time.

Add Comment

Modify Ticket

as closed .
The resolution will be deleted. Next status will be 'reopened'.

E-mail address and user name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.