Sponsored Content
Full Discussion: Timestamp format in HP-UX
Top Forums UNIX for Advanced & Expert Users Timestamp format in HP-UX Post 303018768 by MadeInGermany on Thursday 14th of June 2018 01:59:04 PM
Old 06-14-2018
SysV-derived Unix does not have a stat command. Only the latest Solaris 11 has got it.
I would try perl.
Code:
man perl

leads to
Code:
man perlfunc

for the stat() and localtime() functions.
I pasted the examples, and with a little trial and error I got
Code:
#!/usr/bin/perl
foreach $argfile (@ARGV) {
    ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,
        $atime,$mtime,$ctime,$blksize,$blocks) = stat($argfile);
    ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime($mtime);
    printf "%s-%02d-%02d %02d:%02d:%02d %s\n", 
        $year+1900, $mon+1, $mday, $hour, $min, $sec, $argfile;
}

Now you can make it executable and run it with
Code:
/path/to/perlscript */
find . -type d -exec /path/to/perlscript {} +

These 3 Users Gave Thanks to MadeInGermany For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

how to convert from timestamp to date format in tcsh

hello all im looking for fast way to convert timestamp format to date format and vaiseversa in tcsh , can it be done? thanks allot (2 Replies)
Discussion started by: umen
2 Replies

2. UNIX for Advanced & Expert Users

get the timestamp of a file in desired format

Hi, I have a file say abc. I get the timestamp in following way: ls -ltr abc | awk -F" " '{print $6,$7,$8}' Mar 8 10:23 I need to get the timestamp as : 03-08-2007 10:23:00 Thanks Sumeet (1 Reply)
Discussion started by: sumeet
1 Replies

3. Programming

converting unix timestamp into readable format using c++

hi everyone, im new here and am in desperate need of help. I want to convert my 32 bit unix time stamp ' 45d732f6' into a readable format (Sat, 17 February 2007 16:53:10 UTC) using c++. I have looked around the interent but i just cant make sense of anything. All examples i can find just... (3 Replies)
Discussion started by: uselessprog
3 Replies

4. UNIX for Advanced & Expert Users

ls -l timestamp display format

The time stamp format using "ls -l" is either mmm dd hh:mm or mmm dd yyyy. For later case, how can I know the hh:mm as well. Thanks. (3 Replies)
Discussion started by: pok.fung
3 Replies

5. Shell Programming and Scripting

To convert a date(in string format) to unix timestamp

Hi All, I have a string like below. "Mar 31 2009" . I want to convert this to unix time . Also please let me know how to find the unix time for the above string minus one day. For Eg. if i have string "Mar 31 2009" i want to find the unix time stamp of "Mar 30 2009". Thanks in advance,... (11 Replies)
Discussion started by: girish.raos
11 Replies

6. AIX

Convert unix timestamp to year month day format ?

Hello, How do I convert unix timestamp value to 'normal' date format - to get year month and day values ? Looks like it's easy to do using GNU date (linux systems). But how do I do tthis on AIX ? I don't want to write C program, any ways to do that using unix shells ? thanks (1 Reply)
Discussion started by: vilius
1 Replies

7. UNIX for Dummies Questions & Answers

Format/Fix Timestamp Data in a File.

Hello Experts, I have a timestamp(6) column in a .csv data file , format of the data is as below:- ETCT,P,Elec, Inc.,abc,11/5/2010 4:16:09.000000 PM,Y,Y,Y I want the timestamp column to be properly formatted like 11/05/2010 04:16:09.000000 PM Currently the "0" is missing with... (3 Replies)
Discussion started by: mtlrsk
3 Replies

8. Shell Programming and Scripting

Getting file timestamp in certain format

Hi all, I'm a Unix newbie and I need to get file timestamp in the following format: YYYYMMDD HH24:MM:SS example: 20120713 18:49:30 For start I've tried the following code, but I don't know how to display the year and even format the date: ls -l $filename | awk '{print $7 $6 $8}' My... (4 Replies)
Discussion started by: Braun
4 Replies

9. Shell Programming and Scripting

Convert UNIX timestamp to readable format in the file

Hello I have a file : file1.txt with the below contents : 237176 test1 test2 1442149024 237138 test3 test4 1442121300 237171 test5 test7 1442112823 237145 test9 test10 1442109600 In the above file fourth field represents the timestamp in Unix format. I found a command which converts... (6 Replies)
Discussion started by: rahul2662
6 Replies

10. Shell Programming and Scripting

Convert date in dd mm yyyy format to UNIX timestamp

Hello All, I have a date in DD/MM/YYYY format. I am trying to convert this into unix timestamp. I have tried following: date -d $mydate +%s where mydate = 23/12/2016 00:00:00 I am getting following error: date: extra operand `+%s' Try `date --help' for more information. ... (1 Reply)
Discussion started by: angshuman
1 Replies
Scheduler Implementation API(3) 			 globus scheduler event generator			   Scheduler Implementation API(3)

NAME
Scheduler Implementation API - Enumerations enum globus_scheduler_event_generator_error_t { GLOBUS_SEG_ERROR_TYPE_NULL = 1024, GLOBUS_SEG_ERROR_TYPE_ALREADY_SET, GLOBUS_SEG_ERROR_TYPE_INVALID_MODULE, GLOBUS_SEG_ERROR_TYPE_INVALID_FORMAT, GLOBUS_SEG_ERROR_TYPE_OUT_OF_MEMORY, GLOBUS_SEG_ERROR_TYPE_LOADING_MODULE } Functions globus_result_t globus_scheduler_event (const char *format,...) globus_result_t globus_scheduler_event_pending (time_t timestamp, const char *jobid) globus_result_t globus_scheduler_event_active (time_t timestamp, const char *jobid) globus_result_t globus_scheduler_event_failed (time_t timestamp, const char *jobid, int failure_code) globus_result_t globus_scheduler_event_done (time_t timestamp, const char *jobid, int exit_code) globus_result_t globus_scheduler_event_generator_get_timestamp (time_t *timestamp) Detailed Description Scheduler-specific SEG module implementations use this API to issue events to the Job State Monitor. Events occur whenever a job is placed in the scheduler's queue (PENDING), begins execution (ACTIVE), terminates successfully (DONE), or ends abnormally (FAILED). A SEG module should register an event with the Globus event driver (most likely using either the Globus Callback or Globus XIO interfaces) in its activation function and then return. All events should be triggered from callbacks. When the SEG detects that it should terminate, it will deactivate the SEG module it started. The SEG module should wait for any outstanding callbacks to subside and before returning from its deactivation function to ensure that all events will be properly dispatched. After deactivation is complete, the SEG will unload the shared module and terminate. Enumeration Type Documentation enum globus_scheduler_event_generator_error_t Error types used by the SEG. Enumerator: GLOBUS_SEG_ERROR_TYPE_NULL NULL Parameter. GLOBUS_SEG_ERROR_TYPE_ALREADY_SET Already called a one-time function. GLOBUS_SEG_ERROR_TYPE_INVALID_MODULE Shared module missing descriptor. GLOBUS_SEG_ERROR_TYPE_INVALID_FORMAT Invalid printf format for SEG protocol message. GLOBUS_SEG_ERROR_TYPE_OUT_OF_MEMORY Out of memory. GLOBUS_SEG_ERROR_TYPE_LOADING_MODULE Unable to load scheduler module. Function Documentation globus_result_t globus_scheduler_event (const char *format, ...) Send an arbitrary SEG notification. Parameters: format Printf-style format of the SEG notification message ... Varargs which will be interpreted as per format. Return values: GLOBUS_SUCCESS Scheduler message sent or queued. GLOBUS_SEG_ERROR_NULL Null format. GLOBUS_SEG_ERROR_INVALID_FORMAT Unable to determine length of formatted string. globus_result_t globus_scheduler_event_pending (time_ttimestamp, const char *jobid) Send a job pending event to the JobSchedulerMonitor implementation. Parameters: timestamp Timestamp to use for the event. If set to 0, the time which this function was called is used. jobid String indicating the scheduler-specific name of the job. Return values: GLOBUS_SUCCESS Scheduler message sent or queued. GLOBUS_SEG_ERROR_NULL Null jobid. GLOBUS_SEG_ERROR_INVALID_FORMAT Unable to determine length of formatted string. globus_result_t globus_scheduler_event_active (time_ttimestamp, const char *jobid) Send a job active event to the JobSchedulerMonitor implementation. Parameters: timestamp Timestamp to use for the event. If set to 0, the time which this function was called is used. jobid String indicating the scheduler-specific name of the job. Return values: GLOBUS_SUCCESS Scheduler message sent or queued. GLOBUS_SEG_ERROR_NULL Null jobid. GLOBUS_SEG_ERROR_INVALID_FORMAT Unable to determine length of formatted string. globus_result_t globus_scheduler_event_failed (time_ttimestamp, const char *jobid, intfailure_code) Send a job failed event to the JobSchedulerMonitor implementation. Parameters: timestamp Timestamp to use for the event. If set to 0, the time which this function was called is used. jobid String indicating the scheduler-specific name of the job. failure_code Failure code of the process if known. Return values: GLOBUS_SUCCESS Scheduler message sent or queued. GLOBUS_SEG_ERROR_NULL Null jobid. GLOBUS_SEG_ERROR_INVALID_FORMAT Unable to determine length of formatted string. globus_result_t globus_scheduler_event_done (time_ttimestamp, const char *jobid, intexit_code) Send a job done event to the JobSchedulerMonitor implementation. Parameters: timestamp Timestamp to use for the event. If set to 0, the time which this function was called is used. jobid String indicating the scheduler-specific name of the job. exit_code Exit code of the process if known. Return values: GLOBUS_SUCCESS Scheduler message sent or queued. GLOBUS_SEG_ERROR_NULL Null jobid. GLOBUS_SEG_ERROR_INVALID_FORMAT Unable to determine length of formatted string. globus_result_t globus_scheduler_event_generator_get_timestamp (time_t *timestamp) Get the timestamp for the earliest event an SEG module should send. Parameters: timestamp Pointer to a time_t which will be set to the timestamp passed to the SEG executable. The module should not send any events which occur prior to this timestamp. Return values: GLOBUS_SEG_ERROR_NULL Null timestamp. GLOBUS_SUCCESS Timestamp value updated. If the timestamp was not set on the SEG command-line, then the value pointed to by timestamp will be set to 0. Author Generated automatically by Doxygen for globus scheduler event generator from the source code. Version 4.6 Mon Apr 30 2012 Scheduler Implementation API(3)
All times are GMT -4. The time now is 09:35 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy