import os
from datetime import datetime, timedelta


def getStrTimeNow(format):
    now = datetime.now() + timedelta(hours=0)
    if format == 'HMS' or format == 'hms':
        return now.strftime("%H:%M:%S")
    elif format == 'MS':
        return now.strftime("%M:%S")
    elif format == 'DMYHMS':
        return now.strftime("%d.%m.%Y %H:%M")
    elif format == 'YMDHMS':
        return now.strftime("%Y%m%d_%H%M%S")


def get1pid():
    return str(os.getpid())[-1]
