Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'instance': 0.05; 'parameter': 0.05; 'python': 0.08; 'parameter.': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:80.91.229.12': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'received:lo.gmane.org': 0.09; 'tuple': 0.09; 'argument': 0.15; '0).': 0.16; 'hint': 0.16; 'timestamp': 0.16; 'thanks!': 0.16; 'input': 0.24; 'tried': 0.26; "i'm": 0.27; 'function': 0.27; 'somebody': 0.28; 'charset:iso-8859-15': 0.28; '(even': 0.29; 'example': 0.30; 'hi,': 0.32; 'does': 0.32; 'to:addr:python-list': 0.33; 'header:User-Agent:1': 0.34; 'follows:': 0.34; 'from:addr:googlemail.com': 0.34; 'null': 0.34; 'header:X-Complaints-To:1': 0.35; 'reference': 0.35; 'object': 0.35; 'url:python': 0.36; 'put': 0.37; 'but': 0.37; 'received:org': 0.38; 'url:org': 0.38; 'url:docs': 0.39; 'header :Mime-Version:1': 0.39; 'to:addr:python.org': 0.39; 'description': 0.39; 'kind': 0.61; 'received:89': 0.67; 'datetime': 0.84 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Andreas Subject: Usage of PyDateTime_FromTimestamp Date: Tue, 30 Aug 2011 22:42:29 +0200 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: drms-590dc7d3.pool.mediaways.net User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:6.0) Gecko/20110812 Thunderbird/6.0 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 21 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1314737106 news.xs4all.nl 2547 [2001:888:2000:d::a6]:53402 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:12446 Hi, I'm working on a c-extension of python and want to create an instance of python datetime object with a unix timestamp in c. On the documentation site ( http://docs.python.org/c-api/datetime.html ) I found the function PyDateTime_FromTimestamp() which returns a new reference based on an input parameter. The description is as follows: Create and return a new datetime.datetime object given an argument tuple suitable for passing to datetime.datetime.fromtimestamp(). I tried out to call the function with a PyFloat_Object but the function always returns NULL (even if I simply put in 0). Does somebody have an example how I have to call the function or can give a hint what kind of parameter tuple is required to get it work? Thanks!