TIME(2) System Calls Manual TIME(2)NAME
time, stime - get/set date and time
SYNOPSIS
#include <sys/types.h>
#include <time.h>
time_t time(time_t *tp)
int stime(time_t *tp)
DESCRIPTION
The system's notion of the current Greenwich time is obtained with the time call, and set with the stime call. The time is expressed in
seconds since midnight (0 hour), January 1, 1970. The time is both returned by time and stored in the variable pointed to by tp unless tp
is the null pointer.
Stime obtains the time to set from the variable pointed to by tp.
Only the super-user may set the time of day.
RETURN
A 0 return value from stime indicates that the call succeeded. Time returns the current time on success. A -1 return value indicates an
error occurred, and in this case an error code is stored into the global variable errno.
ERRORS
The following error codes may be set in errno:
[EFAULT] The tp address referenced invalid memory.
[EPERM] A user other than the super-user attempted to set the time.
SEE ALSO date(1), ctime(3).
4th Berkeley Distribution May 14, 1986 TIME(2)
Check Out this Related Man Page
TIME(3F)TIME(3F)NAME
time, ctime, ltime, gmtime - return system time
SYNOPSIS
integer function time()
character*(*) function ctime (stime)
integer stime
subroutine ltime (stime, tarray)
integer stime, tarray(9)
subroutine gmtime (stime, tarray)
integer stime, tarray(9)DESCRIPTION
Time returns the time since 00:00:00 GMT, Jan. 1, 1970, measured in seconds. This is the value of the UNIX system clock.
Ctime converts a system time to a 24 character ASCII string. The format is described under ctime(3). No 'newline' or NULL will be
included.
Ltime and gmtime disect a UNIX time into month, day, etc., either for the local time zone or as GMT. The order and meaning of each element
returned in tarray is described under ctime(3).
FILES
/usr/lib/libU77.a
SEE ALSO ctime(3), itime(3F), idate(3F), fdate(3F)4.2 Berkeley Distribution May 15, 1985 TIME(3F)
Hi All,
I have a situation where I need to copy the files having the latest date.
For example I have a file by name bas100e1_jun05. I need to copy it to bas100e1. But when a file by name bas100e1_jul05 is put in the same directory the script should copy the file having the latest month which... (34 Replies)
Matez,
I have a list of process id's in a text file. I want to know how to find the idle time of a process which are more than 300secs and kill them accordingly.
Could you please help me to get these details. I want to write a shell script with this.
Thanks..Krish :) (36 Replies)
Can someone suggest on this script :
let's say the logs files are available for Jan 07, Dec 06, Nov 06, Oct 06
the script should identify the latest months logs, i.e Jan 07
it should then delete anything older than 2 months, which will be logs for Nov 06 & Oct 06. (40 Replies)
All,
I am new to unix and i have the following requirement.
I have file(s) landing into input directory with timestamp, first i want to copy all these files into seperate directory then i want to rename these files without timestamp and also remove header,trailer from that file..
Could... (35 Replies)
Hi All,
I need to write a UNIX script that automates the sftp process. I should be able to do a sftp to a secure box and get a file from there. I am having a problem doing this because no matter what I do, when I run my script, I get a prompt at command line asking for a password. How could I... (34 Replies)
Every day i ftp tar.gz a file from the production server to a back up machine.. This task creates way to much traffic on the network at the end of the day and puts and undo load on the production machine during operation hours. i would like to create a script that would automatically fire off the... (36 Replies)
Simple question , where did you meet UNIX OS-es.
I started with linux, and then I have meet Solaris and I am all in Solaris right now , almost a year that I am in UNIX, still reading manuals. (35 Replies)
I have a few log files which get generated on a daily basis..So, I need to pick only the ones which get generated for that particular day.
-rw-r--r-- 1 staff 510732676 Apr 7 22:01 test.log040711
-rwxrwxrwx 1 staff 2147482545 Apr 7 21:30 test.log.2
-rwxrwxrwx 1 staff 2147482581 Apr 7 19:26... (43 Replies)
I have created this script
#!/bin/sh
FILES=/data/log/access_*.log
for f in $FILES
do
echo "Processing $f file"
cat $f | awk '{print $1}' | sort | uniq -c | sort -n | tail
done
It produces this output
Processing /data/log/access_abc.log file
114 1.1.1.1
167 2.2.2.2
... (38 Replies)
My original files are like this below and I distinguish them from the AP_ID (file1 has 572 and file2 has 544). Also, the header on file1 has “G_” pre-pended. NOTE: these are only snippets of very large files and much of the data is not present here.
Original File 1:
... (36 Replies)