LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Blogs
User Name
Password

Notices


Old

About Linux timestamps maybe

Posted 01-17-2024 at 02:57 PM by maybeJosiah
Updated 01-31-2024 at 03:42 PM by maybeJosiah (format times maybe)

All Linux has changed time AKA ctime, access time AKA atime, and modified time AKA mtime. Some Linux also has created time/birth time AKA crtime. Like universally all these may be accessed via "stat" with Bash. You may read "stat --help" in your terminal for more specific information. Changed time is last time metadata changed, and others are self explanatory. On some distros "crtime" may be replaced by "btime" and/or "ctime" may be replaved by "chgtime"....
Member
Posted in Uncategorized
Views 167 Comments 0 maybeJosiah is offline
Old

BASH datetime for scripts

Posted 04-05-2020 at 05:16 PM by karanis
Tags bash, time

#!/bin/bash
dt=`date '+%d/%m/%Y %H:%M:%S'`
echo "$dt"
LQ Newbie
Posted in Uncategorized
Views 297 Comments 0 karanis is offline
Old

Set system time to HW clock (BIOS)

Posted 04-05-2020 at 04:24 PM by karanis
Updated 04-05-2020 at 04:26 PM by karanis (I didn`t mention to execute as root)
Tags ntp, time

# hwclock --systohc --localtime

You update your system time from ntp but sometimes, somehow, something happens and it can not sync to hardware clock as it should be and after reboot, you will need ntp again (with an internet connection).

This is a solution to sync ntp clock to BIOS but be aware that, your BIOS clock will need sync in 24 hours but if you do do not care about seconds, it will carry you along.

If you care about microseconds, hehe welcome...
LQ Newbie
Posted in Uncategorized
Views 247 Comments 0 karanis is offline
Old

Date and time functions

Posted 12-09-2013 at 11:34 AM by druuna
Updated 01-31-2014 at 03:25 AM by druuna (Small changes to layout)
Tags date, seconds, time

A handful of date and time related functions that might come in handy.
  • Convert a date or time string to seconds from epoch
PHP Code:
# ------------------------------------------------------------------ #
# Function : dateToSecs
# Syntax   : dateToSecs "[date]"
# Convert a date or time string to seconds from epoch.
# ------------------------------------------------------------------ #
function dateToSecs() {
  [[ $
# -eq 0 ]] && date --utc 
...
LQ Veteran
Posted in General
Views 2412 Comments 0 druuna is offline
Old

Automatically set file date from EXIF data

Posted 12-27-2010 at 02:54 PM by jere21
Updated 12-27-2010 at 02:59 PM by jere21

You can set the creation date of a picture or video as its access and modification time: If the creation date was saved in the exif data of some media, you can extract it with "exiftool -ee -CreateDate" and then "touch" the file with that time.

To do this automatically save the following script e.g. as /usr/local/bin/exiftool_set_create_date
Code:
#!/bin/sh
# exiftool_set_create_date: set the file date from exif "Creation Date".
echo -n "$@:
...
LQ Newbie
Posted in Uncategorized
Views 3243 Comments 0 jere21 is offline

  



All times are GMT -5. The time now is 10:58 AM.

Main Menu
Advertisement
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration