Converting plprocid to a date

plprocid is a time-based hash used as a unique identifier by the NOAO Community Pipeline (CP). Here are a couple of ways to convert plprocid to a date. Note that these methods recover the time in your local timezone, which you may have to adjust to reflect the timezone of the CP (Tucson, AZ).

At the Command Line

In an editor, store the following script and save it as procid2date:

#!/bin/csh
set procid = `echo $1 | tr '[:lower:]' '[:upper:]'`
set unixtime = `echo "ibase=16; $procid * A" | bc`
date -d @$unixtime '+%Y%m%dT%H%M%S'

Then, for example:

procid2date 91adb7f

Output: 20180528T163830

(tested on x86_64 GNU/Linux as displayed by the uname -a command)

Using Python

At the Python prompt:

import datetime
datetime.datetime.fromtimestamp(0x91adb7f * 10)

Output: datetime.datetime(2018, 5, 28, 16, 38, 30)

(tested on Python 3.6.6 |Anaconda, Inc.| (default, Jun 28 2018, 17:14:51))