Path: csiph.com!usenet.pasdenom.info!news.albasani.net!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!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.025 X-Spam-Evidence: '*H*': 0.95; '*S*': 0.00; 'case.': 0.05; 'clock,': 0.09; 'received:mail-vc0-f174.google.com': 0.09; "computer's": 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'subject: \n ': 0.16; 'subject:entire': 0.16; 'utc': 0.16; 'wrote:': 0.17; 'subject:Issue': 0.17; 'skip:p 30': 0.20; 'import': 0.21; 'this:': 0.23; 'header:In-Reply-To:1': 0.25; 'message-id:@mail.gmail.com': 0.27; 'fine': 0.28; '>>>>': 0.29; 'received:209.85.220.174': 0.29; 'reset': 0.29; 'fri,': 0.30; 'function': 0.30; 'not.': 0.32; 'suggestion': 0.32; 'problem': 0.33; 'to:addr:python-list': 0.33; 'hi,': 0.33; 'changed': 0.34; 'received:google.com': 0.34; 'pm,': 0.35; 'received:209.85.220': 0.35; 'received:209.85': 0.35; 'really': 0.36; 'subject:with': 0.36; 'should': 0.36; 'skip:p 20': 0.36; 'possible': 0.37; 'received:209': 0.37; 'subject:: ': 0.38; 'to:addr:python.org': 0.39; 'help': 0.40; 'think': 0.40; 'your': 0.60; 'reply': 0.66; 'serial': 0.66; 'subject:day': 0.66; '2013': 0.84; 'norway': 0.91 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:content-type; bh=v4cBNm8IdNzzQxDLfeQ7hWLpLN6s1/LJqTdE+I8zVXg=; b=m7iIvWB5pm9t35YkZ9DkR7HFfBmwqbcksNIxW/g4x4TBaG+dLYguVsbpvaQbf5pBhc nWYHIcM2mW6EKVtIfvoMF2/ci7ttsh7SYe9GQsW3G6Pp+9cWJtH85Sv5VIx7BQT+osMu wCEXdmIByIzDrcySXamqWi2ZvnilpPts2ECLws2DlBZMIy1Vc4IhCOsAt5GA26dOZHxg 7/+msVPvliXOj+IUqxaDGGeErYXUX74B5UDC+z/PWptqpSDiTRiotQIHsAwl58HKLEzq QpVpYrOb4n1GpfVRd6IA7xls3jbXKe8EQkSwqg6gjKZHiz9UWgqefYRHr0WnUYX7elTr xPLA== MIME-Version: 1.0 X-Received: by 10.58.97.165 with SMTP id eb5mr3817523veb.40.1362124756931; Thu, 28 Feb 2013 23:59:16 -0800 (PST) In-Reply-To: References: Date: Fri, 1 Mar 2013 18:59:16 +1100 Subject: Re: Issue with continous incrementing of unbroken sequence for a entire working day From: Chris Angelico To: python-list@python.org Content-Type: text/plain; charset=ISO-8859-1 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 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: 22 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1362124759 news.xs4all.nl 6905 [2001:888:2000:d::a6]:44806 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:40232 On Fri, Mar 1, 2013 at 6:50 PM, Morten Engvoldsen wrote: > Hi, > No i don't want user to blame when date is changed and serial number > reset when it should not. Do you think the following function will > help for this: > > import datetime as dt >>>> import pytz >>>> utc = pytz.timezone("UTC") >>>> norway = pytz.timezone("Europe/Norway") >>>> a = dt.datetime(2008, 7, 6, 5, 4, 3, tzinfo=utc) >>>> b = a.astimezone(norway) > > Your suggestion is really appreciated.. (posting reply on-list, hope that's okay!) That would be fine for the normal case. It's just possible that the user will change the computer's clock, which would result in the serial changing oddly. If that's not a problem to you, the job's done! ChrisA