Tag Info

New answers tagged

-1

This is not an ntp answer, however... sudo date -s "$(wget -qSO- --max-redirect=0 google.com 2>&1 | grep Date: | cut -d' ' -f5-8)Z" this and the curl version here.


0

If they were off by the same before you changed the file then I would try to go into your BIOS (or BIOS like environment) and seeing if the time is wrong in there. That is were both Ubuntu and Windows gets the time from. You would then change the file back to what it was before. If you do not know how to get to BIOS it is most likely by hitting a f key ...


1

There is a very simple to understand "How To" that is posted in Lubuntu Community Help wiki. The lubuntu date / time display is very adaptable. https://help.ubuntu.com/community/Lubuntu/Documentation/CustomizingTheClock


1

It as simple as installing the NTP daemon on both, and updating the ntp.conf file on the client to use the server as its NTP. However, I found that running ntp on a virtual machine causes issues as updates are applied to the clock of the system running the virtual machine. I would suggest you setup the NTP daemon on the system(s) your virtual machines are ...


1

The digital clock display is very configurable. See these links for more information on how to customize the clock the way you want: http://docs.xfce.org/xfce/xfce4-panel/clock https://developer.gnome.org/pango/stable/PangoMarkupFormat.html I don't recall the original clock format, but here are a few simple examples below: (copy paste one line at a time ...


5

just bash: IFS=: read hour min < <(date +%R) echo $(( 60 * 10#$hour + 10#$min )) Forcing both variables to be treated as base-10, to avoid the shell throwing errors for invalid octal numbers 08 and 09


11

To only get the total minutes of the day, I would use the following command: $ date "+%H*60+%M" | bc Example: $ date +%R 09:30 $ date "+%H*60+%M" | bc 570 The trick is to format the date output to allow bc to interpret and calculate the formula.


1

You don't need to use IFS, you can do it this way: date=$(date +'%l:%M') read H M <<< ${date//[-: ]/ } echo "Total minutes: $(($H * 60 + $M))" output is: Total minutes: 593


3

date +%R | awk -F ":" '{print ($1 * 60) + $2}' Or echo $((($(date +%l) * 60 ) + $(date +%M))) date +%l will get the hours , multiply with 60 and add minutes date +%M


3

Using date and bash: eval "$(date +'today=%F now=%s')"; midnight=$(date -d "$today 0" +%s);echo "$(((now - midnight) / 60))" Example $ date Fr 10. Jul 08:45:05 CEST 2015 $ eval "$(date +'today=%F now=%s')"; midnight=$(date -d "$today 0" +%s);echo "$(((now - midnight) / 60))" 525 Using date and an the z-shell (zsh): IFS=:; set -- $(date +%T); echo ...


0

Ok, for future reference, here is the final solution (with some help from the other answers). The problem was that the hardware clock was wrong, and that apparently due to firewall issues the ubuntu clock can't update automatically. The time of the hardware clock can be changed, either manually by doing sudo hwclock --set --date="02/07/2015 10:21:00" ...



Top 50 recent answers are included