Python datetime.datetime.ctime() Examples

The following are code examples for showing how to use datetime.datetime.ctime(). They are extracted from open source Python projects. You can vote up the examples you like or vote down the exmaples you don't like. You can also save this page to your account.

Example 1
Project: hostapd-mana   Author: adde88   File: idatetime.py    (license) View Source Project 5 votes vote down vote up
def ctime():
        """Return a string representing the date.

        For example date(2002, 12, 4).ctime() == 'Wed Dec 4 00:00:00 2002'.
        d.ctime() is equivalent to time.ctime(time.mktime(d.timetuple()))
        on platforms where the native C ctime() function
        (which time.ctime() invokes, but which date.ctime() does not invoke)
        conforms to the C standard.
        """ 
Example 2
Project: hostapd-mana   Author: adde88   File: idatetime.py    (license) View Source Project 5 votes vote down vote up
def ctime():
        """Return a string representing the date and time.

        datetime(2002, 12, 4, 20, 30, 40).ctime() == 'Wed Dec 4 20:30:40 2002'.
        d.ctime() is equivalent to time.ctime(time.mktime(d.timetuple())) on
        platforms where the native C ctime() function (which time.ctime()
        invokes, but which datetime.ctime() does not invoke) conforms to the
        C standard.
        """ 
Example 3
Project: pyScaf   Author: lpryszcz   File: pyScaf.py    (license) View Source Project 5 votes vote down vote up
def logger(self, mssg="", decorate=1):
        """Logging function."""
        head = "\n%s"%("#"*50,)
        timestamp = "\n[%s]"% datetime.ctime(datetime.now())
        memusage  = "[%5i Mb] "%(resource.getrusage(resource.RUSAGE_SELF).ru_maxrss/1024, )
        if self.log:
            if decorate:
                self.log.write("".join((head, timestamp, memusage, mssg)))
            else:
                self.log.write(mssg) 
Example 4
Project: sslstrip-hsts-openwrt   Author: adde88   File: idatetime.py    (license) View Source Project 5 votes vote down vote up
def ctime():
        """Return a string representing the date.

        For example date(2002, 12, 4).ctime() == 'Wed Dec 4 00:00:00 2002'.
        d.ctime() is equivalent to time.ctime(time.mktime(d.timetuple()))
        on platforms where the native C ctime() function
        (which time.ctime() invokes, but which date.ctime() does not invoke)
        conforms to the C standard.
        """ 
Example 5
Project: sslstrip-hsts-openwrt   Author: adde88   File: idatetime.py    (license) View Source Project 5 votes vote down vote up
def ctime():
        """Return a string representing the date and time.

        datetime(2002, 12, 4, 20, 30, 40).ctime() == 'Wed Dec 4 20:30:40 2002'.
        d.ctime() is equivalent to time.ctime(time.mktime(d.timetuple())) on
        platforms where the native C ctime() function (which time.ctime()
        invokes, but which datetime.ctime() does not invoke) conforms to the
        C standard.
        """ 
Example 6
Project: AskTanmay-NLQA-System-   Author: tanmayb123   File: idatetime.py    (license) View Source Project 5 votes vote down vote up
def ctime():
        """Return a string representing the date.

        For example date(2002, 12, 4).ctime() == 'Wed Dec 4 00:00:00 2002'.
        d.ctime() is equivalent to time.ctime(time.mktime(d.timetuple()))
        on platforms where the native C ctime() function
        (which time.ctime() invokes, but which date.ctime() does not invoke)
        conforms to the C standard.
        """ 
Example 7
Project: AskTanmay-NLQA-System-   Author: tanmayb123   File: idatetime.py    (license) View Source Project 5 votes vote down vote up
def ctime():
        """Return a string representing the date and time.

        datetime(2002, 12, 4, 20, 30, 40).ctime() == 'Wed Dec 4 20:30:40 2002'.
        d.ctime() is equivalent to time.ctime(time.mktime(d.timetuple())) on
        platforms where the native C ctime() function (which time.ctime()
        invokes, but which datetime.ctime() does not invoke) conforms to the
        C standard.
        """ 
Example 8
Project: zenchmarks   Author: squeaky-pl   File: idatetime.py    (license) View Source Project 5 votes vote down vote up
def ctime():
        """Return a string representing the date.

        For example date(2002, 12, 4).ctime() == 'Wed Dec 4 00:00:00 2002'.
        d.ctime() is equivalent to time.ctime(time.mktime(d.timetuple()))
        on platforms where the native C ctime() function
        (which time.ctime() invokes, but which date.ctime() does not invoke)
        conforms to the C standard.
        """ 
Example 9
Project: zenchmarks   Author: squeaky-pl   File: idatetime.py    (license) View Source Project 5 votes vote down vote up
def ctime():
        """Return a string representing the date and time.

        datetime(2002, 12, 4, 20, 30, 40).ctime() == 'Wed Dec 4 20:30:40 2002'.
        d.ctime() is equivalent to time.ctime(time.mktime(d.timetuple())) on
        platforms where the native C ctime() function (which time.ctime()
        invokes, but which datetime.ctime() does not invoke) conforms to the
        C standard.
        """ 
Example 10
Project: HiCembler   Author: lpryszcz   File: test_clustering.py    (license) View Source Project 5 votes vote down vote up
def logger(message, log=sys.stdout):
    """Log messages"""
    memory = resource.getrusage(resource.RUSAGE_SELF).ru_maxrss / 1024
    log.write("[%s] %s    [memory: %6i Mb]\n"%(datetime.ctime(datetime.now()), message, memory))

# update sys.path & environmental PATH 
Example 11
Project: HiCembler   Author: lpryszcz   File: fastq2array.py    (license) View Source Project 5 votes vote down vote up
def logger(message, log=sys.stdout):
    """Log messages"""
    memory = resource.getrusage(resource.RUSAGE_SELF).ru_maxrss / 1024
    log.write("[%s] %s    [memory: %6i Mb]\n"%(datetime.ctime(datetime.now()), message, memory)) 
Example 12
Project: HiCembler   Author: lpryszcz   File: bam2clusters.py    (license) View Source Project 5 votes vote down vote up
def logger(message, log=sys.stdout):
    """Log messages"""
    memory = resource.getrusage(resource.RUSAGE_SELF).ru_maxrss / 1024
    log.write("[%s] %s    [memory: %6i Mb]\n"%(datetime.ctime(datetime.now()), message, memory)) 
Example 13
Project: HiCembler   Author: lpryszcz   File: bam2plot.py    (license) View Source Project 5 votes vote down vote up
def logger(message, log=sys.stdout):
    """Log messages"""
    memory = resource.getrusage(resource.RUSAGE_SELF).ru_maxrss / 1024
    log.write("[%s] %s    [memory: %6i Mb]\n"%(datetime.ctime(datetime.now()), message, memory)) 
Example 14
Project: HiCembler   Author: lpryszcz   File: test_plot.py    (license) View Source Project 5 votes vote down vote up
def logger(message, log=sys.stdout):
    """Log messages"""
    memory = resource.getrusage(resource.RUSAGE_SELF).ru_maxrss / 1024
    log.write("[%s] %s    [memory: %6i Mb]\n"%(datetime.ctime(datetime.now()), message, memory)) 
Example 15
Project: ossim   Author: isislovecruft   File: logger.py    (license) View Source Project 4 votes vote down vote up
def create_logger(level=logging.NOTSET):
    """Create a logger for python-gnupg at a specific message level.

    :type level: :obj:`int` or :obj:`str`
    :param level: A string or an integer for the lowest level to include in
                  logs.

    **Available levels:**

    ==== ======== ========================================
    int   str     description
    ==== ======== ========================================
    0    NOTSET   Disable all logging.
    9    GNUPG    Log GnuPG's internal status messages.
    10   DEBUG    Log module level debuging messages.
    20   INFO     Normal user-level messages.
    30   WARN     Warning messages.
    40   ERROR    Error messages and tracebacks.
    50   CRITICAL Unhandled exceptions and tracebacks.
    ==== ======== ========================================
    """
    _test = os.path.join(os.path.join(os.getcwd(), 'gnupg'), 'test')
    _now  = datetime.now().strftime("%Y-%m-%d_%H%M%S")
    _fn   = os.path.join(_test, "%s_test_gnupg.log" % _now)
    _fmt  = "%(relativeCreated)-4d L%(lineno)-4d:%(funcName)-18.18s %(levelname)-7.7s %(message)s"

    ## Add the GNUPG_STATUS_LEVEL LogRecord to all Loggers in the module:
    logging.addLevelName(GNUPG_STATUS_LEVEL, "GNUPG")
    logging.Logger.status = status

    if level > logging.NOTSET:
        logging.basicConfig(level=level, filename=_fn,
                            filemode="a", format=_fmt)
        logging.logThreads = True
        if hasattr(logging,'captureWarnings'):
            logging.captureWarnings(True)
        colouriser = _ansistrm.ColorizingStreamHandler
        colouriser.level_map[9]  = (None, 'blue', False)
        colouriser.level_map[10] = (None, 'cyan', False)
        handler = colouriser(sys.stderr)
        handler.setLevel(level)

        formatr = logging.Formatter(_fmt)
        handler.setFormatter(formatr)
    else:
        handler = NullHandler()

    log = logging.getLogger('gnupg')
    log.addHandler(handler)
    log.setLevel(level)
    log.info("Log opened: %s UTC" % datetime.ctime(datetime.utcnow()))
    return log