Mailing List Archives
Public Access
|
|
|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [HTCondor-users] convert from 'date +"%H-%M %m-%d-%Y"' to seconds from 1970
- Date: Wed, 06 May 2020 09:17:15 +0200 (CEST)
- From: "Beyer, Christoph" <christoph.beyer@xxxxxxx>
- Subject: Re: [HTCondor-users] convert from 'date +"%H-%M %m-%d-%Y"' to seconds from 1970
Hi Greg,
thanks a lot, and yes I can feel the dust in my lungs - cough-cough, unbelievable, it's time for a face mask literally everywhere nowadays ;)
Should this work:
cincoDeMayo = abstime("2020-05-05T10:30")
STARTD_ATTRS = $(STARTD_ATTRS), cincoDeMayo
condor_status -startd <host> -af cincoDeMayo
? (because I get undefined for now, probably missing something obvious here)
Best
christoph
--
Christoph Beyer
DESY Hamburg
IT-Department
Notkestr. 85
Building 02b, Room 009
22607 Hamburg
phone:+49-(0)40-8998-2317
mail: christoph.beyer@xxxxxxx
----- UrsprÃngliche Mail -----
Von: "gthain" <gthain@xxxxxxxxxxx>
An: "htcondor-users" <htcondor-users@xxxxxxxxxxx>
Gesendet: Dienstag, 5. Mai 2020 17:30:24
Betreff: Re: [HTCondor-users] convert from 'date +"%H-%M %m-%d-%Y"' to seconds from 1970
On 5/5/20 5:18 AM, Beyer, Christoph wrote:
> Hi,
>
> thanks, maybe my question was a bit misleading, I know there are a couple of ways to convert date formats into unix time and back.
Christoph:
This is one of the dusty corners of the classad language. The language
has a separate type for Absolute and Relative time, called "abstime" and
"reltime". You can create an absTime from a string using only one
(sadly, united-states centric) format: YYYY-MM-DDTHH:MM"Â where T is a
literal. So, in classads, could create an attribute with an absTime
value like this:
cincoDeMayo = abstime("2020-05-05T10:30")
But, what you want is not the absTime type, which doesn't have many
operations on it, but the more common Unix epoch format, seconds since
Jan 1, 1970, or in this case (in my time zone), 1588692600. To do this
in classads, you need to convert the absttime to an integer with a
cast. So, try something like
CincoDeUnix = int(abstime("2020-05-05T10:30"))
-greg
_______________________________________________
HTCondor-users mailing list
To unsubscribe, send a message to htcondor-users-request@xxxxxxxxxxx with a
subject: Unsubscribe
You can also unsubscribe by visiting
https://lists.cs.wisc.edu/mailman/listinfo/htcondor-users
The archives can be found at:
https://lists.cs.wisc.edu/archive/htcondor-users/