|
(datetime(2008,9,30,10))+>>>getNow()+datetime.datetime(2008,9,30,10,0,tzinfo=<ICUtzinfo:US/Eastern>)++There'salsoatime_services-awarefunctionforgettingacurrent+timestamp(secondssincetheUTCepoch).++>>>nowTimestamp()+1222783200.0++Thisvalueis,ofcourse,independentofthedefaulttimezone!++>>>TimeZone.default=TimeZone.pacific+>>>nowTimestamp()+1222783200.0++Theabovefunctionsactuallyworkbyusingthe``Time``service+from``peak.events.activity``.Toshowthis,let’sremindourselves+ofwhere(orwhen,actually)weare:++>>>getNow()+datetime.datetime(2008,9,30,7,0,tzinfo=<ICUtzinfo:US/Pacific>)++andnowadvancetimebyanhour:++>>>frompeak.events.activityimportTime+>>>Time.advance(3600.0)+>>>getNow()+datetime.datetime(2008,9,30,8,0,tzinfo=<ICUtzinfo:US/Pacific>)++Similarly,let’screateaPerformercelltowritesomethingonce+30secondselapse:++>>>frompeak.events.trellisimportPerformer+>>>importsys+>>>timer=Time[30]+>>>performer=Performer(lambda:sys.stdout.write("Hello,world!\n")iftimerelseNone)+>>>Time.advance(60)+Hello,world!++Notethat,incaseswhere``setNow``hasbmH |
Sat, 07 Apr, 02:32 |
|
runk/Chandler-Platform/chandler/timemachine.py 2008-10-10 14:39:34 UTC (rev 31)
+++ trunk/Chandler-Platform/chandler/timemachine.py 2008-10-10 14:53:09 UTC (rev 32)
</span><span class="lines">@@ -1,90 +0,0 @@
</span><del>-# Copyright (c) 2003-2007 Open Source Applications Foundation
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-import peak.events.trellis as trellis
-import peak.events.activity as activity
-import peak.context as context
-
-from calendar import timegm
-from datetime import datetime
-from PyICU import ICUtzinfo
-
-def getNow(tz=None):
- """
- Return the current datetime, or the timemachine's pretend time.
-
- The timezone is set to ICUtzinfo.default if tz is None, otherwise
- timezone is set to tz.
-
- """
- if tz is None:
- tz = TimeZone.default
- return datetime.fromtimestamp(activity.Time._now, tz)
-
-def setNow(dt):
- if dt is not None and dt.tzinfo is None:
- dt = dt.replace(tzinfo=ICUtzinfo.default)
-
- timetuple = dt.astimezone(TimeZone.utc).timetuple()
-
- # this ignores calendar.timegm (or time.mktime) range limits and
- # MAXYEAR/MINYEAR, since a now timestamp really shouldn't be outside those
- # ranges
- new_timestamp = timegm(timetuple)
-
- activity.Time.auto_update = False
- activity.Time.advance(new_timestamp - activity.Time._now)
-
-def resetNow():
- activity.Time.auto_update = True
- activity.Time.tick()
-
-def nowTimestamp():
- """The number of seconds betwen the UTC epoch and now."""
- return activity.Time._now
-
-class TimeZone(trellis.Component, context.Service):
-
- default = trellis.attr(ICUtzinfo.default)
-
- @trellis.perform
- def save_default(self):
- ICUtzinfo.setDefault(self.default)
-
- class _FloatingTZInfo(ICUtzinfo):
- def __init__(self): pass
-
- def utcoffset(self, dt):
- return TimeZone.default.utcoffset(dt)
-
- def dst(self, dt):
- return TimeZone.default.dst(dt)
-
- def __repr__(self):
- return "FloatingTZ(%r)" % (TimeZone.default,)
-
- floating = _FloatingTZInfo()
-
- def __getitem__(self, key):
- result = ICUtzinfo.getInstance(key)
- if result.tzid == 'GMT' and key != 'GMT':
- return None
- else:
- return result
-
-
- ### Helper constants
- pacific = ICUtzinfo.getInstance("US/Pacific")
- eastern = ICUtzinfo.getInstance("US/Eastern")
- utc = ICUtzinfo.getInstance("UTC")
</del></span></pre>
</div>
</div>
</body>
</html>
|
Sat, 07 Apr, 02:32 |
|
s set to tz.
-
- """
- if tz is None:
- tz = TimeZone.default
- return datetime.fromtimestamp(activity.Time._now, tz)
-
-def setNow(dt):
- if dt is not None and dt.tzinfo is None:
- dt = dt.replace(tzinfo=ICUtzinfo.default)
-
- timetuple = dt.astimezone(TimeZone.utc).timetuple()
-
- # this ignores calendar.timegm (or time.mktime) range limits and
- # MAXYEAR/MINYEAR, since a now timestamp really shouldn't be outside those
- # ranges
- new_timestamp = timegm(timetuple)
-
- activity.Time.auto_update = False
- activity.Time.advance(new_timestamp - activity.Time._now)
-
-def resetNow():
- activity.Time.auto_update = True
- activity.Time.tick()
-
-def nowTimestamp():
- """The number of seconds betwen the UTC epoch and now."""
- return activity.Time._now
-
-class TimeZone(trellis.Component, context.Service):
-
- default = trellis.attr(ICUtzinfo.default)
-
- @trellis.perform
- def save_default(self):
- ICUtzinfo.setDefault(self.default)
-
- class _FloatingTZInfo(ICUtzinfo):
- def __init__(self): pass
-
- def utcoffset(self, dt):
- return TimeZone.default.utcoffset(dt)
-
- def dst(self, dt):
- return TimeZone.default.dst(dt)
-
- def __repr__(self):
- return "FloatingTZ(%r)" % (TimeZone.default,)
-
- floating = _FloatingTZInfo()
-
- def __getitem__(self, key):
- result = ICUtzinfo.getInstance(key)
- if result.tzid == 'GMT' and key != 'GMT':
- return None
- else:
- return result
-
-
- ### Helper constants
- pacific = ICUtzinfo.getInstance("US/Pacific")
- eastern = ICUtzinfo.getInstance("US/Eastern")
- utc = ICUtzinfo.getInstance("UTC")
</del></span></pre>
</div>
</div>
</body>
</html>
|
Sat, 09 Apr, 18:32 |
|
runk/Chandler-Platform/chandler/timemachine.py 2008-10-10 14:39:34 UTC (rev 31)
+++ trunk/Chandler-Platform/chandler/timemachine.py 2008-10-10 14:53:09 UTC (rev 32)
</span><span class="lines">@@ -1,90 +0,0 @@
</span><del>-# Copyright (c) 2003-2007 Open Source Applications Foundation
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-import peak.events.trellis as trellis
-import peak.events.activity as activity
-import peak.context as context
-
-from calendar import timegm
-from datetime import datetime
-from PyICU import ICUtzinfo
-
-def getNow(tz=None):
- """
- Return the current datetime, or the timemachine's pretend time.
-
- The timezone is set to ICUtzinfo.default if tz is None, otherwise
- timezone is set to tz.
-
- """
- if tz is None:
- tz = TimeZone.default
- return datetime.fromtimestamp(activity.Time._now, tz)
-
-def setNow(dt):
- if dt is not None and dt.tzinfo is None:
- dt = dt.replace(tzinfo=ICUtzinfo.default)
-
- timetuple = dt.astimezone(TimeZone.utc).timetuple()
-
- # this ignores calendar.timegm (or time.mktime) range limits and
- # MAXYEAR/MINYEAR, since a now timestamp really shouldn't be outside those
- # ranges
- new_timestamp = timegm(timetuple)
-
- activity.Time.auto_update = False
- activity.Time.advance(new_timestamp - activity.Time._now)
-
-def resetNow():
- activity.Time.auto_update = True
- activity.Time.tick()
-
-def nowTimestamp():
- """The number of seconds betwen the UTC epoch and now."""
- return activity.Time._now
-
-class TimeZone(trellis.Component, context.Service):
-
- default = trellis.attr(ICUtzinfo.default)
-
- @trellis.perform
- def save_default(self):
- ICUtzinfo.setDefault(self.default)
-
- class _FloatingTZInfo(ICUtzinfo):
- def __init__(self): pass
-
- def utcoffset(self, dt):
- return TimeZone.default.utcoffset(dt)
-
- def dst(self, dt):
- return TimeZone.default.dst(dt)
-
- def __repr__(self):
- return "FloatingTZ(%r)" % (TimeZone.default,)
-
- floating = _FloatingTZInfo()
-
- def __getitem__(self, key):
- result = ICUtzinfo.getInstance(key)
- if result.tzid == 'GMT' and key != 'GMT':
- return None
- else:
- return result
-
-
- ### Helper constants
- pacific = ICUtzinfo.getInstance("US/Pacific")
- eastern = ICUtzinfo.getInstance("US/Eastern")
- utc = ICUtzinfo.getInstance("UTC")
</del></span></pre>
</div>
</div>
</body>
</html>
|
Wed, 30 Nov, 14:35 |
|
runk/Chandler-Platform/chandler/timemachine.py 2008-10-10 14:39:34 UTC (rev 31)
+++ trunk/Chandler-Platform/chandler/timemachine.py 2008-10-10 14:53:09 UTC (rev 32)
</span><span class="lines">@@ -1,90 +0,0 @@
</span><del>-# Copyright (c) 2003-2007 Open Source Applications Foundation
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-import peak.events.trellis as trellis
-import peak.events.activity as activity
-import peak.context as context
-
-from calendar import timegm
-from datetime import datetime
-from PyICU import ICUtzinfo
-
-def getNow(tz=None):
- """
- Return the current datetime, or the timemachine's pretend time.
-
- The timezone is set to ICUtzinfo.default if tz is None, otherwise
- timezone is set to tz.
-
- """
- if tz is None:
- tz = TimeZone.default
- return datetime.fromtimestamp(activity.Time._now, tz)
-
-def setNow(dt):
- if dt is not None and dt.tzinfo is None:
- dt = dt.replace(tzinfo=ICUtzinfo.default)
-
- timetuple = dt.astimezone(TimeZone.utc).timetuple()
-
- # this ignores calendar.timegm (or time.mktime) range limits and
- # MAXYEAR/MINYEAR, since a now timestamp really shouldn't be outside those
- # ranges
- new_timestamp = timegm(timetuple)
-
- activity.Time.auto_update = False
- activity.Time.advance(new_timestamp - activity.Time._now)
-
-def resetNow():
- activity.Time.auto_update = True
- activity.Time.tick()
-
-def nowTimestamp():
- """The number of seconds betwen the UTC epoch and now."""
- return activity.Time._now
-
-class TimeZone(trellis.Component, context.Service):
-
- default = trellis.attr(ICUtzinfo.default)
-
- @trellis.perform
- def save_default(self):
- ICUtzinfo.setDefault(self.default)
-
- class _FloatingTZInfo(ICUtzinfo):
- def __init__(self): pass
-
- def utcoffset(self, dt):
- return TimeZone.default.utcoffset(dt)
-
- def dst(self, dt):
- return TimeZone.default.dst(dt)
-
- def __repr__(self):
- return "FloatingTZ(%r)" % (TimeZone.default,)
-
- floating = _FloatingTZInfo()
-
- def __getitem__(self, key):
- result = ICUtzinfo.getInstance(key)
- if result.tzid == 'GMT' and key != 'GMT':
- return None
- else:
- return result
-
-
- ### Helper constants
- pacific = ICUtzinfo.getInstance("US/Pacific")
- eastern = ICUtzinfo.getInstance("US/Eastern")
- utc = ICUtzinfo.getInstance("UTC")
</del></span></pre>
</div>
</div>
</body>
</html>
|
Wed, 30 Nov, 14:35 |
| <andre_mueningh...@fastmail.fm> |
cations Foundation
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-import peak.events.trellis as trellis
-import peak.events.activity as activity
-import peak.context as context
-
-from calendar import timegm
-from datetime import datetime
-from PyICU import ICUtzinfo
-
-def getNow(tz=None):
- """
- Return the current datetime, or the timemachine's pretend time.
-
- The timezone is set to ICUtzinfo.default if tz is None, otherwise
- timezone is set to tz.
-
- """
- if tz is None:
- tz = TimeZone.default
- return datetime.fromtimestamp(activity.Time._now, tz)
-
-def setNow(dt):
- if dt is not None and dt.tzinfo is None:
- dt = dt.replace(tzinfo=ICUtzinfo.default)
-
- timetuple = dt.astimezone(TimeZone.utc).timetuple()
-
- # this ignores calendar.timegm (or time.mktime) range limits and
- # MAXYEAR/MINYEAR, since a now timestamp really shouldn't be outside those
- # ranges
- new_timestamp = timegm(timetuple)
-
- activity.Time.auto_update = False
- activity.Time.advance(new_timestamp - activity.Time._now)
-
-def resetNow():
- activity.Time.auto_update = True
- activity.Time.tick()
-
-def nowTimestamp():
- """The number of seconds betwen the UTC epoch and now."""
- return activity.Time._now
-
-class TimeZone(trellis.Component, context.Service):
-
- default = trellis.attr(ICUtzinfo.default)
-
- @trellis.perform
- def save_default(self):
- ICUtzinfo.setDefault(self.default)
-
- class _FloatingTZInfo(ICUtzinfo):
- def __init__(self): pass
-
- def utcoffset(self, dt):
- return TimeZone.default.utcoffset(dt)
-
- def dst(self, dt):
- return TimeZone.default.dst(dt)
-
- def __repr__(self):
- return "FloatingTZ(%r)" % (TimeZone.default,)
-
- floating = _FloatingTZInfo()
-
- def __getitem__(self, key):
- result = ICUtzinfo.getInstance(key)
- if result.tzid == 'GMT' and key != 'GMT':
- return None
- else:
- return result
-
-
- ### Helper constants
- pacific = ICUtzinfo.getInstance("US/Pacific")
- eastern = ICUtzinfo.getInstance("US/Eastern")
- utc = ICUtzinfo.getInstance("UTC")
</del></span></pre>
</div>
</div>
</body>
</html>
|
Wed, 28 May, 18:41 |
| <andre_mueningh...@fastmail.fm> |
cations Foundation
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-import peak.events.trellis as trellis
-import peak.events.activity as activity
-import peak.context as context
-
-from calendar import timegm
-from datetime import datetime
-from PyICU import ICUtzinfo
-
-def getNow(tz=None):
- """
- Return the current datetime, or the timemachine's pretend time.
-
- The timezone is set to ICUtzinfo.default if tz is None, otherwise
- timezone is set to tz.
-
- """
- if tz is None:
- tz = TimeZone.default
- return datetime.fromtimestamp(activity.Time._now, tz)
-
-def setNow(dt):
- if dt is not None and dt.tzinfo is None:
- dt = dt.replace(tzinfo=ICUtzinfo.default)
-
- timetuple = dt.astimezone(TimeZone.utc).timetuple()
-
- # this ignores calendar.timegm (or time.mktime) range limits and
- # MAXYEAR/MINYEAR, since a now timestamp really shouldn't be outside those
- # ranges
- new_timestamp = timegm(timetuple)
-
- activity.Time.auto_update = False
- activity.Time.advance(new_timestamp - activity.Time._now)
-
-def resetNow():
- activity.Time.auto_update = True
- activity.Time.tick()
-
-def nowTimestamp():
- """The number of seconds betwen the UTC epoch and now."""
- return activity.Time._now
-
-class TimeZone(trellis.Component, context.Service):
-
- default = trellis.attr(ICUtzinfo.default)
-
- @trellis.perform
- def save_default(self):
- ICUtzinfo.setDefault(self.default)
-
- class _FloatingTZInfo(ICUtzinfo):
- def __init__(self): pass
-
- def utcoffset(self, dt):
- return TimeZone.default.utcoffset(dt)
-
- def dst(self, dt):
- return TimeZone.default.dst(dt)
-
- def __repr__(self):
- return "FloatingTZ(%r)" % (TimeZone.default,)
-
- floating = _FloatingTZInfo()
-
- def __getitem__(self, key):
- result = ICUtzinfo.getInstance(key)
- if result.tzid == 'GMT' and key != 'GMT':
- return None
- else:
- return result
-
-
- ### Helper constants
- pacific = ICUtzinfo.getInstance("US/Pacific")
- eastern = ICUtzinfo.getInstance("US/Eastern")
- utc = ICUtzinfo.getInstance("UTC")
</del></span></pre>
</div>
</div>
</body>
</html>
|
Wed, 28 May, 18:41 |
| <...@osafoundation.org> |
former=Performer(lambda:sys.stdout.write("Hello,world!\n")iftimerelseNone)+>>>Time.advance(60)+Hello,world!++Notethat,incaseswhere``setNow``hasbmH |
Tue, 12 May, 17:36 |
| <...@osafoundation.org> |
-from datetime import datetime
-from PyICU import ICUtzinfo
-
-def getNow(tz=None):
- """
- Return the current datetime, or the timemachine's pretend time.
-
- The timezone is set to ICUtzinfo.default if tz is None, otherwise
- timezone is set to tz.
-
- """
- if tz is None:
- tz = TimeZone.default
- return datetime.fromtimestamp(activity.Time._now, tz)
-
-def setNow(dt):
- if dt is not None and dt.tzinfo is None:
- dt = dt.replace(tzinfo=ICUtzinfo.default)
-
- timetuple = dt.astimezone(TimeZone.utc).timetuple()
-
- # this ignores calendar.timegm (or time.mktime) range limits and
- # MAXYEAR/MINYEAR, since a now timestamp really shouldn't be outside those
- # ranges
- new_timestamp = timegm(timetuple)
-
- activity.Time.auto_update = False
- activity.Time.advance(new_timestamp - activity.Time._now)
-
-def resetNow():
- activity.Time.auto_update = True
- activity.Time.tick()
-
-def nowTimestamp():
- """The number of seconds betwen the UTC epoch and now."""
- return activity.Time._now
-
-class TimeZone(trellis.Component, context.Service):
-
- default = trellis.attr(ICUtzinfo.default)
-
- @trellis.perform
- def save_default(self):
- ICUtzinfo.setDefault(self.default)
-
- class _FloatingTZInfo(ICUtzinfo):
- def __init__(self): pass
-
- def utcoffset(self, dt):
- return TimeZone.default.utcoffset(dt)
-
- def dst(self, dt):
- return TimeZone.default.dst(dt)
-
- def __repr__(self):
- return "FloatingTZ(%r)" % (TimeZone.default,)
-
- floating = _FloatingTZInfo()
-
- def __getitem__(self, key):
- result = ICUtzinfo.getInstance(key)
- if result.tzid == 'GMT' and key != 'GMT':
- return None
- else:
- return result
-
-
- ### Helper constants
- pacific = ICUtzinfo.getInstance("US/Pacific")
- eastern = ICUtzinfo.getInstance("US/Eastern")
- utc = ICUtzinfo.getInstance("UTC")
</del></span></pre>
</div>
</div>
</body>
</html>
|
Tue, 12 May, 17:36 |
| <harts...@osafoundation.org> |
tc = ICUtzinfo.getInstance("UTC")
</del></span></pre>
</div>
</div>
</body>
</html>
|
Sun, 12 Apr, 21:12 |
| <harts...@osafoundation.org> |
tc = ICUtzinfo.getInstance("UTC")
</del></span></pre>
</div>
</div>
</body>
</html>
|
Sun, 12 Apr, 21:12 |
| <insightfxidwwil...@mightysideshow.com> |
Foundation
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-import peak.events.trellis as trellis
-import peak.events.activity as activity
-import peak.context as context
-
-from calendar import timegm
-from datetime import datetime
-from PyICU import ICUtzinfo
-
-def getNow(tz=None):
- """
- Return the current datetime, or the timemachine's pretend time.
-
- The timezone is set to ICUtzinfo.default if tz is None, otherwise
- timezone is set to tz.
-
- """
- if tz is None:
- tz = TimeZone.default
- return datetime.fromtimestamp(activity.Time._now, tz)
-
-def setNow(dt):
- if dt is not None and dt.tzinfo is None:
- dt = dt.replace(tzinfo=ICUtzinfo.default)
-
- timetuple = dt.astimezone(TimeZone.utc).timetuple()
-
- # this ignores calendar.timegm (or time.mktime) range limits and
- # MAXYEAR/MINYEAR, since a now timestamp really shouldn't be outside those
- # ranges
- new_timestamp = timegm(timetuple)
-
- activity.Time.auto_update = False
- activity.Time.advance(new_timestamp - activity.Time._now)
-
-def resetNow():
- activity.Time.auto_update = True
- activity.Time.tick()
-
-def nowTimestamp():
- """The number of seconds betwen the UTC epoch and now."""
- return activity.Time._now
-
-class TimeZone(trellis.Component, context.Service):
-
- default = trellis.attr(ICUtzinfo.default)
-
- @trellis.perform
- def save_default(self):
- ICUtzinfo.setDefault(self.default)
-
- class _FloatingTZInfo(ICUtzinfo):
- def __init__(self): pass
-
- def utcoffset(self, dt):
- return TimeZone.default.utcoffset(dt)
-
- def dst(self, dt):
- return TimeZone.default.dst(dt)
-
- def __repr__(self):
- return "FloatingTZ(%r)" % (TimeZone.default,)
-
- floating = _FloatingTZInfo()
-
- def __getitem__(self, key):
- result = ICUtzinfo.getInstance(key)
- if result.tzid == 'GMT' and key != 'GMT':
- return None
- else:
- return result
-
-
- ### Helper constants
- pacific = ICUtzinfo.getInstance("US/Pacific")
- eastern = ICUtzinfo.getInstance("US/Eastern")
- utc = ICUtzinfo.getInstance("UTC")
</del></span></pre>
</div>
</div>
</body>
</html>
|
Sat, 01 Jan, 18:00 |
| <ka...@uclink.berkeley.edu> |
quot;/archives/commits-cosmo/200709.mbox/author" title="Browse September 2007 archives">Sep 2007</a></td><td class="msgcount">296</td>
</tr>
<tr id="boxactive"> <td class="box"><a href="/archives/commits-cosmo/200708.mbox/author" title="Browse August 2007 archives">Aug 2007</a></td><X<" |
Tue, 21 May, 04:38 |
| <mor...@osafoundation.org> |
ot;UTC")</del> |
Sun, 18 Nov, 07:51 |
| <mor...@osafoundation.org> |
class="box"><a href="/archives/commits-cosmo/200708.mbox/author" title="Browse August 2007 archives">Aug 2007</a></td><X<" |
Sun, 18 Nov, 07:51 |
| <mor...@osafoundation.org> |
class="box"><a href="/archives/commits-cosmo/200708.mbox/author" title="Browse August 2007 archives">Aug 2007</a></td><X<" |
Sun, 18 Nov, 07:51 |
| <mor...@sagen.com> |
class="box"><a href="/archives/commits-cosmo/200708.mbox/author" title="Browse August 2007 archives">Aug 2007</a></td><X<" |
Sun, 18 Nov, 07:51 |
| <postmas...@laweleka.osafoundation.org> |
er=Performer(lambda:sys.stdout.write("Hello,world!\n")iftimerelseNone)+>>>Time.advance(60)+Hello,world!++Notethat,incaseswhere``setNow``hasbmH |
Wed, 05 Aug, 17:04 |
| <postmas...@laweleka.osafoundation.org> |
er=Performer(lambda:sys.stdout.write("Hello,world!\n")iftimerelseNone)+>>>Time.advance(60)+Hello,world!++Notethat,incaseswhere``setNow``hasbmH |
Wed, 05 Aug, 17:04 |
| <postmas...@laweleka.osafoundation.org> |
om datetime import datetime
-from PyICU import ICUtzinfo
-
-def getNow(tz=None):
- """
- Return the current datetime, or the timemachine's pretend time.
-
- The timezone is set to ICUtzinfo.default if tz is None, otherwise
- timezone is set to tz.
-
- """
- if tz is None:
- tz = TimeZone.default
- return datetime.fromtimestamp(activity.Time._now, tz)
-
-def setNow(dt):
- if dt is not None and dt.tzinfo is None:
- dt = dt.replace(tzinfo=ICUtzinfo.default)
-
- timetuple = dt.astimezone(TimeZone.utc).timetuple()
-
- # this ignores calendar.timegm (or time.mktime) range limits and
- # MAXYEAR/MINYEAR, since a now timestamp really shouldn't be outside those
- # ranges
- new_timestamp = timegm(timetuple)
-
- activity.Time.auto_update = False
- activity.Time.advance(new_timestamp - activity.Time._now)
-
-def resetNow():
- activity.Time.auto_update = True
- activity.Time.tick()
-
-def nowTimestamp():
- """The number of seconds betwen the UTC epoch and now."""
- return activity.Time._now
-
-class TimeZone(trellis.Component, context.Service):
-
- default = trellis.attr(ICUtzinfo.default)
-
- @trellis.perform
- def save_default(self):
- ICUtzinfo.setDefault(self.default)
-
- class _FloatingTZInfo(ICUtzinfo):
- def __init__(self): pass
-
- def utcoffset(self, dt):
- return TimeZone.default.utcoffset(dt)
-
- def dst(self, dt):
- return TimeZone.default.dst(dt)
-
- def __repr__(self):
- return "FloatingTZ(%r)" % (TimeZone.default,)
-
- floating = _FloatingTZInfo()
-
- def __getitem__(self, key):
- result = ICUtzinfo.getInstance(key)
- if result.tzid == 'GMT' and key != 'GMT':
- return None
- else:
- return result
-
-
- ### Helper constants
- pacific = ICUtzinfo.getInstance("US/Pacific")
- eastern = ICUtzinfo.getInstance("US/Eastern")
- utc = ICUtzinfo.getInstance("UTC")
</del></span></pre>
</div>
</div>
</body>
</html>
|
Wed, 05 Aug, 17:04 |
| <postmas...@laweleka.osafoundation.org> |
om datetime import datetime
-from PyICU import ICUtzinfo
-
-def getNow(tz=None):
- """
- Return the current datetime, or the timemachine's pretend time.
-
- The timezone is set to ICUtzinfo.default if tz is None, otherwise
- timezone is set to tz.
-
- """
- if tz is None:
- tz = TimeZone.default
- return datetime.fromtimestamp(activity.Time._now, tz)
-
-def setNow(dt):
- if dt is not None and dt.tzinfo is None:
- dt = dt.replace(tzinfo=ICUtzinfo.default)
-
- timetuple = dt.astimezone(TimeZone.utc).timetuple()
-
- # this ignores calendar.timegm (or time.mktime) range limits and
- # MAXYEAR/MINYEAR, since a now timestamp really shouldn't be outside those
- # ranges
- new_timestamp = timegm(timetuple)
-
- activity.Time.auto_update = False
- activity.Time.advance(new_timestamp - activity.Time._now)
-
-def resetNow():
- activity.Time.auto_update = True
- activity.Time.tick()
-
-def nowTimestamp():
- """The number of seconds betwen the UTC epoch and now."""
- return activity.Time._now
-
-class TimeZone(trellis.Component, context.Service):
-
- default = trellis.attr(ICUtzinfo.default)
-
- @trellis.perform
- def save_default(self):
- ICUtzinfo.setDefault(self.default)
-
- class _FloatingTZInfo(ICUtzinfo):
- def __init__(self): pass
-
- def utcoffset(self, dt):
- return TimeZone.default.utcoffset(dt)
-
- def dst(self, dt):
- return TimeZone.default.dst(dt)
-
- def __repr__(self):
- return "FloatingTZ(%r)" % (TimeZone.default,)
-
- floating = _FloatingTZInfo()
-
- def __getitem__(self, key):
- result = ICUtzinfo.getInstance(key)
- if result.tzid == 'GMT' and key != 'GMT':
- return None
- else:
- return result
-
-
- ### Helper constants
- pacific = ICUtzinfo.getInstance("US/Pacific")
- eastern = ICUtzinfo.getInstance("US/Eastern")
- utc = ICUtzinfo.getInstance("UTC")
</del></span></pre>
</div>
</div>
</body>
</html>
|
Wed, 05 Aug, 17:04 |
| <postmas...@laweleka.osafoundation.org> |
om datetime import datetime
-from PyICU import ICUtzinfo
-
-def getNow(tz=None):
- """
- Return the current datetime, or the timemachine's pretend time.
-
- The timezone is set to ICUtzinfo.default if tz is None, otherwise
- timezone is set to tz.
-
- """
- if tz is None:
- tz = TimeZone.default
- return datetime.fromtimestamp(activity.Time._now, tz)
-
-def setNow(dt):
- if dt is not None and dt.tzinfo is None:
- dt = dt.replace(tzinfo=ICUtzinfo.default)
-
- timetuple = dt.astimezone(TimeZone.utc).timetuple()
-
- # this ignores calendar.timegm (or time.mktime) range limits and
- # MAXYEAR/MINYEAR, since a now timestamp really shouldn't be outside those
- # ranges
- new_timestamp = timegm(timetuple)
-
- activity.Time.auto_update = False
- activity.Time.advance(new_timestamp - activity.Time._now)
-
-def resetNow():
- activity.Time.auto_update = True
- activity.Time.tick()
-
-def nowTimestamp():
- """The number of seconds betwen the UTC epoch and now."""
- return activity.Time._now
-
-class TimeZone(trellis.Component, context.Service):
-
- default = trellis.attr(ICUtzinfo.default)
-
- @trellis.perform
- def save_default(self):
- ICUtzinfo.setDefault(self.default)
-
- class _FloatingTZInfo(ICUtzinfo):
- def __init__(self): pass
-
- def utcoffset(self, dt):
- return TimeZone.default.utcoffset(dt)
-
- def dst(self, dt):
- return TimeZone.default.dst(dt)
-
- def __repr__(self):
- return "FloatingTZ(%r)" % (TimeZone.default,)
-
- floating = _FloatingTZInfo()
-
- def __getitem__(self, key):
- result = ICUtzinfo.getInstance(key)
- if result.tzid == 'GMT' and key != 'GMT':
- return None
- else:
- return result
-
-
- ### Helper constants
- pacific = ICUtzinfo.getInstance("US/Pacific")
- eastern = ICUtzinfo.getInstance("US/Eastern")
- utc = ICUtzinfo.getInstance("UTC")
</del></span></pre>
</div>
</div>
</body>
</html>
|
Wed, 05 Aug, 17:04 |
| <postmas...@laweleka.osafoundation.org> |
om datetime import datetime
-from PyICU import ICUtzinfo
-
-def getNow(tz=None):
- """
- Return the current datetime, or the timemachine's pretend time.
-
- The timezone is set to ICUtzinfo.default if tz is None, otherwise
- timezone is set to tz.
-
- """
- if tz is None:
- tz = TimeZone.default
- return datetime.fromtimestamp(activity.Time._now, tz)
-
-def setNow(dt):
- if dt is not None and dt.tzinfo is None:
- dt = dt.replace(tzinfo=ICUtzinfo.default)
-
- timetuple = dt.astimezone(TimeZone.utc).timetuple()
-
- # this ignores calendar.timegm (or time.mktime) range limits and
- # MAXYEAR/MINYEAR, since a now timestamp really shouldn't be outside those
- # ranges
- new_timestamp = timegm(timetuple)
-
- activity.Time.auto_update = False
- activity.Time.advance(new_timestamp - activity.Time._now)
-
-def resetNow():
- activity.Time.auto_update = True
- activity.Time.tick()
-
-def nowTimestamp():
- """The number of seconds betwen the UTC epoch and now."""
- return activity.Time._now
-
-class TimeZone(trellis.Component, context.Service):
-
- default = trellis.attr(ICUtzinfo.default)
-
- @trellis.perform
- def save_default(self):
- ICUtzinfo.setDefault(self.default)
-
- class _FloatingTZInfo(ICUtzinfo):
- def __init__(self): pass
-
- def utcoffset(self, dt):
- return TimeZone.default.utcoffset(dt)
-
- def dst(self, dt):
- return TimeZone.default.dst(dt)
-
- def __repr__(self):
- return "FloatingTZ(%r)" % (TimeZone.default,)
-
- floating = _FloatingTZInfo()
-
- def __getitem__(self, key):
- result = ICUtzinfo.getInstance(key)
- if result.tzid == 'GMT' and key != 'GMT':
- return None
- else:
- return result
-
-
- ### Helper constants
- pacific = ICUtzinfo.getInstance("US/Pacific")
- eastern = ICUtzinfo.getInstance("US/Eastern")
- utc = ICUtzinfo.getInstance("UTC")
</del></span></pre>
</div>
</div>
</body>
</html>
|
Wed, 05 Aug, 17:04 |
| <proje...@modernactivity.com> |
F36RPHF36IDPF36DIAF36AF36VIDF36HF36ELEDF36 |
Sat, 06 Sep, 20:54 |
| <rcott...@cottiss.com> |
s Foundation
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-import peak.events.trellis as trellis
-import peak.events.activity as activity
-import peak.context as context
-
-from calendar import timegm
-from datetime import datetime
-from PyICU import ICUtzinfo
-
-def getNow(tz=None):
- """
- Return the current datetime, or the timemachine's pretend time.
-
- The timezone is set to ICUtzinfo.default if tz is None, otherwise
- timezone is set to tz.
-
- """
- if tz is None:
- tz = TimeZone.default
- return datetime.fromtimestamp(activity.Time._now, tz)
-
-def setNow(dt):
- if dt is not None and dt.tzinfo is None:
- dt = dt.replace(tzinfo=ICUtzinfo.default)
-
- timetuple = dt.astimezone(TimeZone.utc).timetuple()
-
- # this ignores calendar.timegm (or time.mktime) range limits and
- # MAXYEAR/MINYEAR, since a now timestamp really shouldn't be outside those
- # ranges
- new_timestamp = timegm(timetuple)
-
- activity.Time.auto_update = False
- activity.Time.advance(new_timestamp - activity.Time._now)
-
-def resetNow():
- activity.Time.auto_update = True
- activity.Time.tick()
-
-def nowTimestamp():
- """The number of seconds betwen the UTC epoch and now."""
- return activity.Time._now
-
-class TimeZone(trellis.Component, context.Service):
-
- default = trellis.attr(ICUtzinfo.default)
-
- @trellis.perform
- def save_default(self):
- ICUtzinfo.setDefault(self.default)
-
- class _FloatingTZInfo(ICUtzinfo):
- def __init__(self): pass
-
- def utcoffset(self, dt):
- return TimeZone.default.utcoffset(dt)
-
- def dst(self, dt):
- return TimeZone.default.dst(dt)
-
- def __repr__(self):
- return "FloatingTZ(%r)" % (TimeZone.default,)
-
- floating = _FloatingTZInfo()
-
- def __getitem__(self, key):
- result = ICUtzinfo.getInstance(key)
- if result.tzid == 'GMT' and key != 'GMT':
- return None
- else:
- return result
-
-
- ### Helper constants
- pacific = ICUtzinfo.getInstance("US/Pacific")
- eastern = ICUtzinfo.getInstance("US/Eastern")
- utc = ICUtzinfo.getInstance("UTC")
</del></span></pre>
</div>
</div>
</body>
</html>
|
Sat, 22 Jun, 00:06 |
| <rcott...@cottiss.com> |
s Foundation
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-import peak.events.trellis as trellis
-import peak.events.activity as activity
-import peak.context as context
-
-from calendar import timegm
-from datetime import datetime
-from PyICU import ICUtzinfo
-
-def getNow(tz=None):
- """
- Return the current datetime, or the timemachine's pretend time.
-
- The timezone is set to ICUtzinfo.default if tz is None, otherwise
- timezone is set to tz.
-
- """
- if tz is None:
- tz = TimeZone.default
- return datetime.fromtimestamp(activity.Time._now, tz)
-
-def setNow(dt):
- if dt is not None and dt.tzinfo is None:
- dt = dt.replace(tzinfo=ICUtzinfo.default)
-
- timetuple = dt.astimezone(TimeZone.utc).timetuple()
-
- # this ignores calendar.timegm (or time.mktime) range limits and
- # MAXYEAR/MINYEAR, since a now timestamp really shouldn't be outside those
- # ranges
- new_timestamp = timegm(timetuple)
-
- activity.Time.auto_update = False
- activity.Time.advance(new_timestamp - activity.Time._now)
-
-def resetNow():
- activity.Time.auto_update = True
- activity.Time.tick()
-
-def nowTimestamp():
- """The number of seconds betwen the UTC epoch and now."""
- return activity.Time._now
-
-class TimeZone(trellis.Component, context.Service):
-
- default = trellis.attr(ICUtzinfo.default)
-
- @trellis.perform
- def save_default(self):
- ICUtzinfo.setDefault(self.default)
-
- class _FloatingTZInfo(ICUtzinfo):
- def __init__(self): pass
-
- def utcoffset(self, dt):
- return TimeZone.default.utcoffset(dt)
-
- def dst(self, dt):
- return TimeZone.default.dst(dt)
-
- def __repr__(self):
- return "FloatingTZ(%r)" % (TimeZone.default,)
-
- floating = _FloatingTZInfo()
-
- def __getitem__(self, key):
- result = ICUtzinfo.getInstance(key)
- if result.tzid == 'GMT' and key != 'GMT':
- return None
- else:
- return result
-
-
- ### Helper constants
- pacific = ICUtzinfo.getInstance("US/Pacific")
- eastern = ICUtzinfo.getInstance("US/Eastern")
- utc = ICUtzinfo.getInstance("UTC")
</del></span></pre>
</div>
</div>
</body>
</html>
|
Sat, 22 Jun, 00:06 |
| <rcott...@cottiss.com> |
s Foundation
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-import peak.events.trellis as trellis
-import peak.events.activity as activity
-import peak.context as context
-
-from calendar import timegm
-from datetime import datetime
-from PyICU import ICUtzinfo
-
-def getNow(tz=None):
- """
- Return the current datetime, or the timemachine's pretend time.
-
- The timezone is set to ICUtzinfo.default if tz is None, otherwise
- timezone is set to tz.
-
- """
- if tz is None:
- tz = TimeZone.default
- return datetime.fromtimestamp(activity.Time._now, tz)
-
-def setNow(dt):
- if dt is not None and dt.tzinfo is None:
- dt = dt.replace(tzinfo=ICUtzinfo.default)
-
- timetuple = dt.astimezone(TimeZone.utc).timetuple()
-
- # this ignores calendar.timegm (or time.mktime) range limits and
- # MAXYEAR/MINYEAR, since a now timestamp really shouldn't be outside those
- # ranges
- new_timestamp = timegm(timetuple)
-
- activity.Time.auto_update = False
- activity.Time.advance(new_timestamp - activity.Time._now)
-
-def resetNow():
- activity.Time.auto_update = True
- activity.Time.tick()
-
-def nowTimestamp():
- """The number of seconds betwen the UTC epoch and now."""
- return activity.Time._now
-
-class TimeZone(trellis.Component, context.Service):
-
- default = trellis.attr(ICUtzinfo.default)
-
- @trellis.perform
- def save_default(self):
- ICUtzinfo.setDefault(self.default)
-
- class _FloatingTZInfo(ICUtzinfo):
- def __init__(self): pass
-
- def utcoffset(self, dt):
- return TimeZone.default.utcoffset(dt)
-
- def dst(self, dt):
- return TimeZone.default.dst(dt)
-
- def __repr__(self):
- return "FloatingTZ(%r)" % (TimeZone.default,)
-
- floating = _FloatingTZInfo()
-
- def __getitem__(self, key):
- result = ICUtzinfo.getInstance(key)
- if result.tzid == 'GMT' and key != 'GMT':
- return None
- else:
- return result
-
-
- ### Helper constants
- pacific = ICUtzinfo.getInstance("US/Pacific")
- eastern = ICUtzinfo.getInstance("US/Eastern")
- utc = ICUtzinfo.getInstance("UTC")
</del></span></pre>
</div>
</div>
</body>
</html>
|
Sat, 22 Jun, 00:06 |
| <rcott...@cottiss.com> |
s Foundation
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-import peak.events.trellis as trellis
-import peak.events.activity as activity
-import peak.context as context
-
-from calendar import timegm
-from datetime import datetime
-from PyICU import ICUtzinfo
-
-def getNow(tz=None):
- """
- Return the current datetime, or the timemachine's pretend time.
-
- The timezone is set to ICUtzinfo.default if tz is None, otherwise
- timezone is set to tz.
-
- """
- if tz is None:
- tz = TimeZone.default
- return datetime.fromtimestamp(activity.Time._now, tz)
-
-def setNow(dt):
- if dt is not None and dt.tzinfo is None:
- dt = dt.replace(tzinfo=ICUtzinfo.default)
-
- timetuple = dt.astimezone(TimeZone.utc).timetuple()
-
- # this ignores calendar.timegm (or time.mktime) range limits and
- # MAXYEAR/MINYEAR, since a now timestamp really shouldn't be outside those
- # ranges
- new_timestamp = timegm(timetuple)
-
- activity.Time.auto_update = False
- activity.Time.advance(new_timestamp - activity.Time._now)
-
-def resetNow():
- activity.Time.auto_update = True
- activity.Time.tick()
-
-def nowTimestamp():
- """The number of seconds betwen the UTC epoch and now."""
- return activity.Time._now
-
-class TimeZone(trellis.Component, context.Service):
-
- default = trellis.attr(ICUtzinfo.default)
-
- @trellis.perform
- def save_default(self):
- ICUtzinfo.setDefault(self.default)
-
- class _FloatingTZInfo(ICUtzinfo):
- def __init__(self): pass
-
- def utcoffset(self, dt):
- return TimeZone.default.utcoffset(dt)
-
- def dst(self, dt):
- return TimeZone.default.dst(dt)
-
- def __repr__(self):
- return "FloatingTZ(%r)" % (TimeZone.default,)
-
- floating = _FloatingTZInfo()
-
- def __getitem__(self, key):
- result = ICUtzinfo.getInstance(key)
- if result.tzid == 'GMT' and key != 'GMT':
- return None
- else:
- return result
-
-
- ### Helper constants
- pacific = ICUtzinfo.getInstance("US/Pacific")
- eastern = ICUtzinfo.getInstance("US/Eastern")
- utc = ICUtzinfo.getInstance("UTC")
</del></span></pre>
</div>
</div>
</body>
</html>
|
Sat, 22 Jun, 00:06 |
| <rcott...@cottiss.com> |
s Foundation
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-import peak.events.trellis as trellis
-import peak.events.activity as activity
-import peak.context as context
-
-from calendar import timegm
-from datetime import datetime
-from PyICU import ICUtzinfo
-
-def getNow(tz=None):
- """
- Return the current datetime, or the timemachine's pretend time.
-
- The timezone is set to ICUtzinfo.default if tz is None, otherwise
- timezone is set to tz.
-
- """
- if tz is None:
- tz = TimeZone.default
- return datetime.fromtimestamp(activity.Time._now, tz)
-
-def setNow(dt):
- if dt is not None and dt.tzinfo is None:
- dt = dt.replace(tzinfo=ICUtzinfo.default)
-
- timetuple = dt.astimezone(TimeZone.utc).timetuple()
-
- # this ignores calendar.timegm (or time.mktime) range limits and
- # MAXYEAR/MINYEAR, since a now timestamp really shouldn't be outside those
- # ranges
- new_timestamp = timegm(timetuple)
-
- activity.Time.auto_update = False
- activity.Time.advance(new_timestamp - activity.Time._now)
-
-def resetNow():
- activity.Time.auto_update = True
- activity.Time.tick()
-
-def nowTimestamp():
- """The number of seconds betwen the UTC epoch and now."""
- return activity.Time._now
-
-class TimeZone(trellis.Component, context.Service):
-
- default = trellis.attr(ICUtzinfo.default)
-
- @trellis.perform
- def save_default(self):
- ICUtzinfo.setDefault(self.default)
-
- class _FloatingTZInfo(ICUtzinfo):
- def __init__(self): pass
-
- def utcoffset(self, dt):
- return TimeZone.default.utcoffset(dt)
-
- def dst(self, dt):
- return TimeZone.default.dst(dt)
-
- def __repr__(self):
- return "FloatingTZ(%r)" % (TimeZone.default,)
-
- floating = _FloatingTZInfo()
-
- def __getitem__(self, key):
- result = ICUtzinfo.getInstance(key)
- if result.tzid == 'GMT' and key != 'GMT':
- return None
- else:
- return result
-
-
- ### Helper constants
- pacific = ICUtzinfo.getInstance("US/Pacific")
- eastern = ICUtzinfo.getInstance("US/Eastern")
- utc = ICUtzinfo.getInstance("UTC")
</del></span></pre>
</div>
</div>
</body>
</html>
|
Sat, 22 Jun, 00:06 |
| <rcott...@cottiss.com> |
s Foundation
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-import peak.events.trellis as trellis
-import peak.events.activity as activity
-import peak.context as context
-
-from calendar import timegm
-from datetime import datetime
-from PyICU import ICUtzinfo
-
-def getNow(tz=None):
- """
- Return the current datetime, or the timemachine's pretend time.
-
- The timezone is set to ICUtzinfo.default if tz is None, otherwise
- timezone is set to tz.
-
- """
- if tz is None:
- tz = TimeZone.default
- return datetime.fromtimestamp(activity.Time._now, tz)
-
-def setNow(dt):
- if dt is not None and dt.tzinfo is None:
- dt = dt.replace(tzinfo=ICUtzinfo.default)
-
- timetuple = dt.astimezone(TimeZone.utc).timetuple()
-
- # this ignores calendar.timegm (or time.mktime) range limits and
- # MAXYEAR/MINYEAR, since a now timestamp really shouldn't be outside those
- # ranges
- new_timestamp = timegm(timetuple)
-
- activity.Time.auto_update = False
- activity.Time.advance(new_timestamp - activity.Time._now)
-
-def resetNow():
- activity.Time.auto_update = True
- activity.Time.tick()
-
-def nowTimestamp():
- """The number of seconds betwen the UTC epoch and now."""
- return activity.Time._now
-
-class TimeZone(trellis.Component, context.Service):
-
- default = trellis.attr(ICUtzinfo.default)
-
- @trellis.perform
- def save_default(self):
- ICUtzinfo.setDefault(self.default)
-
- class _FloatingTZInfo(ICUtzinfo):
- def __init__(self): pass
-
- def utcoffset(self, dt):
- return TimeZone.default.utcoffset(dt)
-
- def dst(self, dt):
- return TimeZone.default.dst(dt)
-
- def __repr__(self):
- return "FloatingTZ(%r)" % (TimeZone.default,)
-
- floating = _FloatingTZInfo()
-
- def __getitem__(self, key):
- result = ICUtzinfo.getInstance(key)
- if result.tzid == 'GMT' and key != 'GMT':
- return None
- else:
- return result
-
-
- ### Helper constants
- pacific = ICUtzinfo.getInstance("US/Pacific")
- eastern = ICUtzinfo.getInstance("US/Eastern")
- utc = ICUtzinfo.getInstance("UTC")
</del></span></pre>
</div>
</div>
</body>
</html>
|
Sat, 22 Jun, 00:06 |
| .com |
etime import datetime
-from PyICU import ICUtzinfo
-
-def getNow(tz=None):
- """
- Return the current datetime, or the timemachine's pretend time.
-
- The timezone is set to ICUtzinfo.default if tz is None, otherwise
- timezone is set to tz.
-
- """
- if tz is None:
- tz = TimeZone.default
- return datetime.fromtimestamp(activity.Time._now, tz)
-
-def setNow(dt):
- if dt is not None and dt.tzinfo is None:
- dt = dt.replace(tzinfo=ICUtzinfo.default)
-
- timetuple = dt.astimezone(TimeZone.utc).timetuple()
-
- # this ignores calendar.timegm (or time.mktime) range limits and
- # MAXYEAR/MINYEAR, since a now timestamp really shouldn't be outside those
- # ranges
- new_timestamp = timegm(timetuple)
-
- activity.Time.auto_update = False
- activity.Time.advance(new_timestamp - activity.Time._now)
-
-def resetNow():
- activity.Time.auto_update = True
- activity.Time.tick()
-
-def nowTimestamp():
- """The number of seconds betwen the UTC epoch and now."""
- return activity.Time._now
-
-class TimeZone(trellis.Component, context.Service):
-
- default = trellis.attr(ICUtzinfo.default)
-
- @trellis.perform
- def save_default(self):
- ICUtzinfo.setDefault(self.default)
-
- class _FloatingTZInfo(ICUtzinfo):
- def __init__(self): pass
-
- def utcoffset(self, dt):
- return TimeZone.default.utcoffset(dt)
-
- def dst(self, dt):
- return TimeZone.default.dst(dt)
-
- def __repr__(self):
- return "FloatingTZ(%r)" % (TimeZone.default,)
-
- floating = _FloatingTZInfo()
-
- def __getitem__(self, key):
- result = ICUtzinfo.getInstance(key)
- if result.tzid == 'GMT' and key != 'GMT':
- return None
- else:
- return result
-
-
- ### Helper constants
- pacific = ICUtzinfo.getInstance("US/Pacific")
- eastern = ICUtzinfo.getInstance("US/Eastern")
- utc = ICUtzinfo.getInstance("UTC")
</del></span></pre>
</div>
</div>
</body>
</html>
|
Sun, 05 Mar, 00:46 |
| 7.@gmx.at> |
[No Subject] |
Fri, 15 Nov, 08:32 |
| 7.@gmx.at> |
[No Subject] |
Fri, 15 Nov, 08:32 |
| 7.@gmx.at> |
[No Subject] |
Fri, 15 Nov, 08:32 |
| 7.@gmx.at> |
[No Subject] |
Fri, 15 Nov, 08:32 |
| Parlante |
eturnNone-else:-returnresult---###Helperconstants-pacific=ICUtzinfo.getInstance("US/Pacific")-eastern=ICUtzinfo.getInstance("US/Eastern")-utc=ICUtzinfo.getInstance("UTC")</del> |
Sat, 09 Apr, 03:30 |
| Parlante |
etInstance("US/Pacific")
- eastern = ICUtzinfo.getInstance("US/Eastern")
- utc = ICUtzinfo.getInstance("UTC")
</del></span></pre>
</div>
</div>
</body>
</html>
|
Sat, 09 Apr, 03:30 |
| Parlante |
etInstance("US/Pacific")
- eastern = ICUtzinfo.getInstance("US/Eastern")
- utc = ICUtzinfo.getInstance("UTC")
</del></span></pre>
</div>
</div>
</body>
</html>
|
Sat, 09 Apr, 03:30 |
| Parlante |
etInstance("US/Pacific")
- eastern = ICUtzinfo.getInstance("US/Eastern")
- utc = ICUtzinfo.getInstance("UTC")
</del></span></pre>
</div>
</div>
</body>
</html>
|
Sat, 09 Apr, 03:30 |
| bl...@orcaware.com |
c = ICUtzinfo.getInstance("US/Pacific")
- eastern = ICUtzinfo.getInstance("US/Eastern")
- utc = ICUtzinfo.getInstance("UTC")
</del></span></pre>
</div>
</div>
</body>
</html>
|
Sat, 21 Mar, 18:18 |
| b.@osafoundation.org |
':-returnNone-else:-returnresult---###Helperconstants-pacific=ICUtzinfo.getInstance("US/Pacific")-eastern=ICUtzinfo.getInstance("US/Eastern")-utc=ICUtzinfo.getInstance("UTC")</del> |
Thu, 25 Apr, 03:33 |
| d...@kei.com> |
=TimeZone.default-returndatetime.fromtimestamp(activity.Time._now,tz)--defsetNow(dt):-ifdtisnotNoneanddt.tzinfoisNone:-dt=dt.replace(tzinfo=ICUtzinfo.default)--timetuple=dt.astimezone(TimeZone.utc).timetuple()--#thisignorescalendar.timegm(ortime.mktime)rangelimitsand-#MAXYEAR/MINYEAR,sinceanowtimestampreallyshouldn'tbeoutsidethose-#ranges-new_timestamp=timegm(timetuple)--activity.Time.auto_update=False-activity.Time.advance(new_timestamp-activity.Time._now)--defresetNow():-activity.Time.auto_update=True-activity.Time.tick()--defnowTimestamp():-"""ThenumberofsecondsbetwentheUTCepochandnow."""-returnactivity.Time._now--classTimeZone(trellis.Component,context.Service):--default=trellis.attr(ICUtzinfo.default)--@trellis.perform-defsave_default(self):-ICUtzinfo.setDefault(self.default)--class_FloatingTZInfo(ICUtzinfo):-def__init__(self):pass--defutcoffset(self,dt):-returnTimeZone.default.utcoffset(dt)--defdst(self,dt):-returnTimeZone.default.dst(dt)--def__repr__(self):-return"FloatingTZ(%r)"%(TimeZone.default,)--floating=_FloatingTZInfo()--def__getitem__(self,key):-result=ICUtzinfo.getInstance(key)-ifresult.tzid=='GMT'andkey!='GMT':-returnNone-else:-returnresult---###Helperconstants-pacific=ICUtzinfo.getInstance("US/Pacific")-eastern=ICUtzinfo.getInstance("US/Eastern")-utc=ICUtzinfo.getInstance("UTC")</del> |
Thu, 03 Oct, 23:00 |
| e |
= ICUtzinfo.getInstance("UTC")
</del></span></pre>
</div>
</div>
</body>
</html>
|
Thu, 08 Apr, 18:59 |
| e |
ied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-import peak.events.trellis as trellis
-import peak.events.activity as activity
-import peak.context as context
-
-from calendar import timegm
-from datetime import datetime
-from PyICU import ICUtzinfo
-
-def getNow(tz=None):
- """
- Return the current datetime, or the timemachine's pretend time.
-
- The timezone is set to ICUtzinfo.default if tz is None, otherwise
- timezone is set to tz.
-
- """
- if tz is None:
- tz = TimeZone.default
- return datetime.fromtimestamp(activity.Time._now, tz)
-
-def setNow(dt):
- if dt is not None and dt.tzinfo is None:
- dt = dt.replace(tzinfo=ICUtzinfo.default)
-
- timetuple = dt.astimezone(TimeZone.utc).timetuple()
-
- # this ignores calendar.timegm (or time.mktime) range limits and
- # MAXYEAR/MINYEAR, since a now timestamp really shouldn't be outside those
- # ranges
- new_timestamp = timegm(timetuple)
-
- activity.Time.auto_update = False
- activity.Time.advance(new_timestamp - activity.Time._now)
-
-def resetNow():
- activity.Time.auto_update = True
- activity.Time.tick()
-
-def nowTimestamp():
- """The number of seconds betwen the UTC epoch and now."""
- return activity.Time._now
-
-class TimeZone(trellis.Component, context.Service):
-
- default = trellis.attr(ICUtzinfo.default)
-
- @trellis.perform
- def save_default(self):
- ICUtzinfo.setDefault(self.default)
-
- class _FloatingTZInfo(ICUtzinfo):
- def __init__(self): pass
-
- def utcoffset(self, dt):
- return TimeZone.default.utcoffset(dt)
-
- def dst(self, dt):
- return TimeZone.default.dst(dt)
-
- def __repr__(self):
- return "FloatingTZ(%r)" % (TimeZone.default,)
-
- floating = _FloatingTZInfo()
-
- def __getitem__(self, key):
- result = ICUtzinfo.getInstance(key)
- if result.tzid == 'GMT' and key != 'GMT':
- return None
- else:
- return result
-
-
- ### Helper constants
- pacific = ICUtzinfo.getInstance("US/Pacific")
- eastern = ICUtzinfo.getInstance("US/Eastern")
- utc = ICUtzinfo.getInstance("UTC")
</del></span></pre>
</div>
</div>
</body>
</html>
|
Tue, 21 Mar, 19:22 |
| est...@osafoundation.org> |
)--class_FloatingTZInfo(ICUtzinfo):-def__init__(self):pass--defutcoffset(self,dt):-returnTimeZone.default.utcoffset(dt)--defdst(self,dt):-returnTimeZone.default.dst(dt)--def__repr__(self):-return"FloatingTZ(%r)"%(TimeZone.default,)--floating=_FloatingTZInfo()--def__getitem__(self,key):-result=ICUtzinfo.getInstance(key)-ifresult.tzid=='GMT'andkey!='GMT':-returnNone-else:-returnresult---###Helperconstants-pacific=ICUtzinfo.getInstance("US/Pacific")-eastern=ICUtzinfo.getInstance("US/Eastern")-utc=ICUtzinfo.getInstance("UTC")</del> |
Tue, 28 Oct, 00:35 |
| est...@osafoundation.org> |
ting = _FloatingTZInfo()
-
- def __getitem__(self, key):
- result = ICUtzinfo.getInstance(key)
- if result.tzid == 'GMT' and key != 'GMT':
- return None
- else:
- return result
-
-
- ### Helper constants
- pacific = ICUtzinfo.getInstance("US/Pacific")
- eastern = ICUtzinfo.getInstance("US/Eastern")
- utc = ICUtzinfo.getInstance("UTC")
</del></span></pre>
</div>
</div>
</body>
</html>
|
Tue, 28 Oct, 00:35 |
| est...@osafoundation.org> |
:
- def __init__(self): pass
-
- def utcoffset(self, dt):
- return TimeZone.default.utcoffset(dt)
-
- def dst(self, dt):
- return TimeZone.default.dst(dt)
-
- def __repr__(self):
- return "FloatingTZ(%r)" % (TimeZone.default,)
-
- floating = _FloatingTZInfo()
-
- def __getitem__(self, key):
- result = ICUtzinfo.getInstance(key)
- if result.tzid == 'GMT' and key != 'GMT':
- return None
- else:
- return result
-
-
- ### Helper constants
- pacific = ICUtzinfo.getInstance("US/Pacific")
- eastern = ICUtzinfo.getInstance("US/Eastern")
- utc = ICUtzinfo.getInstance("UTC")
</del></span></pre>
</div>
</div>
</body>
</html>
|
Tue, 28 Oct, 00:35 |
| est...@osafoundation.org> |
:
- def __init__(self): pass
-
- def utcoffset(self, dt):
- return TimeZone.default.utcoffset(dt)
-
- def dst(self, dt):
- return TimeZone.default.dst(dt)
-
- def __repr__(self):
- return "FloatingTZ(%r)" % (TimeZone.default,)
-
- floating = _FloatingTZInfo()
-
- def __getitem__(self, key):
- result = ICUtzinfo.getInstance(key)
- if result.tzid == 'GMT' and key != 'GMT':
- return None
- else:
- return result
-
-
- ### Helper constants
- pacific = ICUtzinfo.getInstance("US/Pacific")
- eastern = ICUtzinfo.getInstance("US/Eastern")
- utc = ICUtzinfo.getInstance("UTC")
</del></span></pre>
</div>
</div>
</body>
</html>
|
Tue, 28 Oct, 00:35 |
| est...@osafoundation.org> |
:
- def __init__(self): pass
-
- def utcoffset(self, dt):
- return TimeZone.default.utcoffset(dt)
-
- def dst(self, dt):
- return TimeZone.default.dst(dt)
-
- def __repr__(self):
- return "FloatingTZ(%r)" % (TimeZone.default,)
-
- floating = _FloatingTZInfo()
-
- def __getitem__(self, key):
- result = ICUtzinfo.getInstance(key)
- if result.tzid == 'GMT' and key != 'GMT':
- return None
- else:
- return result
-
-
- ### Helper constants
- pacific = ICUtzinfo.getInstance("US/Pacific")
- eastern = ICUtzinfo.getInstance("US/Eastern")
- utc = ICUtzinfo.getInstance("UTC")
</del></span></pre>
</div>
</div>
</body>
</html>
|
Tue, 28 Oct, 00:35 |
| est...@osafoundation.org> |
:
- def __init__(self): pass
-
- def utcoffset(self, dt):
- return TimeZone.default.utcoffset(dt)
-
- def dst(self, dt):
- return TimeZone.default.dst(dt)
-
- def __repr__(self):
- return "FloatingTZ(%r)" % (TimeZone.default,)
-
- floating = _FloatingTZInfo()
-
- def __getitem__(self, key):
- result = ICUtzinfo.getInstance(key)
- if result.tzid == 'GMT' and key != 'GMT':
- return None
- else:
- return result
-
-
- ### Helper constants
- pacific = ICUtzinfo.getInstance("US/Pacific")
- eastern = ICUtzinfo.getInstance("US/Eastern")
- utc = ICUtzinfo.getInstance("UTC")
</del></span></pre>
</div>
</div>
</body>
</html>
|
Tue, 28 Oct, 00:35 |
| e...@kei.com> |
)--class_FloatingTZInfo(ICUtzinfo):-def__init__(self):pass--defutcoffset(self,dt):-returnTimeZone.default.utcoffset(dt)--defdst(self,dt):-returnTimeZone.default.dst(dt)--def__repr__(self):-return"FloatingTZ(%r)"%(TimeZone.default,)--floating=_FloatingTZInfo()--def__getitem__(self,key):-result=ICUtzinfo.getInstance(key)-ifresult.tzid=='GMT'andkey!='GMT':-returnNone-else:-returnresult---###Helperconstants-pacific=ICUtzinfo.getInstance("US/Pacific")-eastern=ICUtzinfo.getInstance("US/Eastern")-utc=ICUtzinfo.getInstance("UTC")</del> |
Tue, 28 Oct, 00:35 |
| e...@kei.com> |
:
- def __init__(self): pass
-
- def utcoffset(self, dt):
- return TimeZone.default.utcoffset(dt)
-
- def dst(self, dt):
- return TimeZone.default.dst(dt)
-
- def __repr__(self):
- return "FloatingTZ(%r)" % (TimeZone.default,)
-
- floating = _FloatingTZInfo()
-
- def __getitem__(self, key):
- result = ICUtzinfo.getInstance(key)
- if result.tzid == 'GMT' and key != 'GMT':
- return None
- else:
- return result
-
-
- ### Helper constants
- pacific = ICUtzinfo.getInstance("US/Pacific")
- eastern = ICUtzinfo.getInstance("US/Eastern")
- utc = ICUtzinfo.getInstance("UTC")
</del></span></pre>
</div>
</div>
</body>
</html>
|
Tue, 28 Oct, 00:35 |
| e...@kei.com> |
:
- def __init__(self): pass
-
- def utcoffset(self, dt):
- return TimeZone.default.utcoffset(dt)
-
- def dst(self, dt):
- return TimeZone.default.dst(dt)
-
- def __repr__(self):
- return "FloatingTZ(%r)" % (TimeZone.default,)
-
- floating = _FloatingTZInfo()
-
- def __getitem__(self, key):
- result = ICUtzinfo.getInstance(key)
- if result.tzid == 'GMT' and key != 'GMT':
- return None
- else:
- return result
-
-
- ### Helper constants
- pacific = ICUtzinfo.getInstance("US/Pacific")
- eastern = ICUtzinfo.getInstance("US/Eastern")
- utc = ICUtzinfo.getInstance("UTC")
</del></span></pre>
</div>
</div>
</body>
</html>
|
Tue, 28 Oct, 00:35 |
| eton |
time import datetime
-from PyICU import ICUtzinfo
-
-def getNow(tz=None):
- """
- Return the current datetime, or the timemachine's pretend time.
-
- The timezone is set to ICUtzinfo.default if tz is None, otherwise
- timezone is set to tz.
-
- """
- if tz is None:
- tz = TimeZone.default
- return datetime.fromtimestamp(activity.Time._now, tz)
-
-def setNow(dt):
- if dt is not None and dt.tzinfo is None:
- dt = dt.replace(tzinfo=ICUtzinfo.default)
-
- timetuple = dt.astimezone(TimeZone.utc).timetuple()
-
- # this ignores calendar.timegm (or time.mktime) range limits and
- # MAXYEAR/MINYEAR, since a now timestamp really shouldn't be outside those
- # ranges
- new_timestamp = timegm(timetuple)
-
- activity.Time.auto_update = False
- activity.Time.advance(new_timestamp - activity.Time._now)
-
-def resetNow():
- activity.Time.auto_update = True
- activity.Time.tick()
-
-def nowTimestamp():
- """The number of seconds betwen the UTC epoch and now."""
- return activity.Time._now
-
-class TimeZone(trellis.Component, context.Service):
-
- default = trellis.attr(ICUtzinfo.default)
-
- @trellis.perform
- def save_default(self):
- ICUtzinfo.setDefault(self.default)
-
- class _FloatingTZInfo(ICUtzinfo):
- def __init__(self): pass
-
- def utcoffset(self, dt):
- return TimeZone.default.utcoffset(dt)
-
- def dst(self, dt):
- return TimeZone.default.dst(dt)
-
- def __repr__(self):
- return "FloatingTZ(%r)" % (TimeZone.default,)
-
- floating = _FloatingTZInfo()
-
- def __getitem__(self, key):
- result = ICUtzinfo.getInstance(key)
- if result.tzid == 'GMT' and key != 'GMT':
- return None
- else:
- return result
-
-
- ### Helper constants
- pacific = ICUtzinfo.getInstance("US/Pacific")
- eastern = ICUtzinfo.getInstance("US/Eastern")
- utc = ICUtzinfo.getInstance("UTC")
</del></span></pre>
</div>
</div>
</body>
</html>
|
Sun, 13 Nov, 20:15 |
| ghoff |
<td class="box"><a href="/archives/commits-cosmo/200708.dtext/html; charset=UTF-8 |
Sun, 31 Jul, 21:15 |
| ia |
atetime.datetime(2008,9,30,8,0,tzinfo=<ICUtzinfo:US/Pacific>)++Similarly,let’screateaPerformercelltowritesomethingonce+30secondselapse:++>>>frompeak.events.trellisimportPerformer+>>>importsys+>>>timer=Time[30]+>>>performer=Performer(lambda:sys.stdout.write("Hello,world!\n")iftimerelseNone)+>>>Time.advance(60)+Hello,world!++Notethat,incaseswhere``setNow``hasbmH |
Mon, 26 May, 09:29 |
| ia |
plied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-import peak.events.trellis as trellis
-import peak.events.activity as activity
-import peak.context as context
-
-from calendar import timegm
-from datetime import datetime
-from PyICU import ICUtzinfo
-
-def getNow(tz=None):
- """
- Return the current datetime, or the timemachine's pretend time.
-
- The timezone is set to ICUtzinfo.default if tz is None, otherwise
- timezone is set to tz.
-
- """
- if tz is None:
- tz = TimeZone.default
- return datetime.fromtimestamp(activity.Time._now, tz)
-
-def setNow(dt):
- if dt is not None and dt.tzinfo is None:
- dt = dt.replace(tzinfo=ICUtzinfo.default)
-
- timetuple = dt.astimezone(TimeZone.utc).timetuple()
-
- # this ignores calendar.timegm (or time.mktime) range limits and
- # MAXYEAR/MINYEAR, since a now timestamp really shouldn't be outside those
- # ranges
- new_timestamp = timegm(timetuple)
-
- activity.Time.auto_update = False
- activity.Time.advance(new_timestamp - activity.Time._now)
-
-def resetNow():
- activity.Time.auto_update = True
- activity.Time.tick()
-
-def nowTimestamp():
- """The number of seconds betwen the UTC epoch and now."""
- return activity.Time._now
-
-class TimeZone(trellis.Component, context.Service):
-
- default = trellis.attr(ICUtzinfo.default)
-
- @trellis.perform
- def save_default(self):
- ICUtzinfo.setDefault(self.default)
-
- class _FloatingTZInfo(ICUtzinfo):
- def __init__(self): pass
-
- def utcoffset(self, dt):
- return TimeZone.default.utcoffset(dt)
-
- def dst(self, dt):
- return TimeZone.default.dst(dt)
-
- def __repr__(self):
- return "FloatingTZ(%r)" % (TimeZone.default,)
-
- floating = _FloatingTZInfo()
-
- def __getitem__(self, key):
- result = ICUtzinfo.getInstance(key)
- if result.tzid == 'GMT' and key != 'GMT':
- return None
- else:
- return result
-
-
- ### Helper constants
- pacific = ICUtzinfo.getInstance("US/Pacific")
- eastern = ICUtzinfo.getInstance("US/Eastern")
- utc = ICUtzinfo.getInstance("UTC")
</del></span></pre>
</div>
</div>
</body>
</html>
|
Mon, 26 May, 09:29 |
| ia |
plied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-import peak.events.trellis as trellis
-import peak.events.activity as activity
-import peak.context as context
-
-from calendar import timegm
-from datetime import datetime
-from PyICU import ICUtzinfo
-
-def getNow(tz=None):
- """
- Return the current datetime, or the timemachine's pretend time.
-
- The timezone is set to ICUtzinfo.default if tz is None, otherwise
- timezone is set to tz.
-
- """
- if tz is None:
- tz = TimeZone.default
- return datetime.fromtimestamp(activity.Time._now, tz)
-
-def setNow(dt):
- if dt is not None and dt.tzinfo is None:
- dt = dt.replace(tzinfo=ICUtzinfo.default)
-
- timetuple = dt.astimezone(TimeZone.utc).timetuple()
-
- # this ignores calendar.timegm (or time.mktime) range limits and
- # MAXYEAR/MINYEAR, since a now timestamp really shouldn't be outside those
- # ranges
- new_timestamp = timegm(timetuple)
-
- activity.Time.auto_update = False
- activity.Time.advance(new_timestamp - activity.Time._now)
-
-def resetNow():
- activity.Time.auto_update = True
- activity.Time.tick()
-
-def nowTimestamp():
- """The number of seconds betwen the UTC epoch and now."""
- return activity.Time._now
-
-class TimeZone(trellis.Component, context.Service):
-
- default = trellis.attr(ICUtzinfo.default)
-
- @trellis.perform
- def save_default(self):
- ICUtzinfo.setDefault(self.default)
-
- class _FloatingTZInfo(ICUtzinfo):
- def __init__(self): pass
-
- def utcoffset(self, dt):
- return TimeZone.default.utcoffset(dt)
-
- def dst(self, dt):
- return TimeZone.default.dst(dt)
-
- def __repr__(self):
- return "FloatingTZ(%r)" % (TimeZone.default,)
-
- floating = _FloatingTZInfo()
-
- def __getitem__(self, key):
- result = ICUtzinfo.getInstance(key)
- if result.tzid == 'GMT' and key != 'GMT':
- return None
- else:
- return result
-
-
- ### Helper constants
- pacific = ICUtzinfo.getInstance("US/Pacific")
- eastern = ICUtzinfo.getInstance("US/Eastern")
- utc = ICUtzinfo.getInstance("UTC")
</del></span></pre>
</div>
</div>
</body>
</html>
|
Mon, 26 May, 09:29 |
| ia |
plied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-import peak.events.trellis as trellis
-import peak.events.activity as activity
-import peak.context as context
-
-from calendar import timegm
-from datetime import datetime
-from PyICU import ICUtzinfo
-
-def getNow(tz=None):
- """
- Return the current datetime, or the timemachine's pretend time.
-
- The timezone is set to ICUtzinfo.default if tz is None, otherwise
- timezone is set to tz.
-
- """
- if tz is None:
- tz = TimeZone.default
- return datetime.fromtimestamp(activity.Time._now, tz)
-
-def setNow(dt):
- if dt is not None and dt.tzinfo is None:
- dt = dt.replace(tzinfo=ICUtzinfo.default)
-
- timetuple = dt.astimezone(TimeZone.utc).timetuple()
-
- # this ignores calendar.timegm (or time.mktime) range limits and
- # MAXYEAR/MINYEAR, since a now timestamp really shouldn't be outside those
- # ranges
- new_timestamp = timegm(timetuple)
-
- activity.Time.auto_update = False
- activity.Time.advance(new_timestamp - activity.Time._now)
-
-def resetNow():
- activity.Time.auto_update = True
- activity.Time.tick()
-
-def nowTimestamp():
- """The number of seconds betwen the UTC epoch and now."""
- return activity.Time._now
-
-class TimeZone(trellis.Component, context.Service):
-
- default = trellis.attr(ICUtzinfo.default)
-
- @trellis.perform
- def save_default(self):
- ICUtzinfo.setDefault(self.default)
-
- class _FloatingTZInfo(ICUtzinfo):
- def __init__(self): pass
-
- def utcoffset(self, dt):
- return TimeZone.default.utcoffset(dt)
-
- def dst(self, dt):
- return TimeZone.default.dst(dt)
-
- def __repr__(self):
- return "FloatingTZ(%r)" % (TimeZone.default,)
-
- floating = _FloatingTZInfo()
-
- def __getitem__(self, key):
- result = ICUtzinfo.getInstance(key)
- if result.tzid == 'GMT' and key != 'GMT':
- return None
- else:
- return result
-
-
- ### Helper constants
- pacific = ICUtzinfo.getInstance("US/Pacific")
- eastern = ICUtzinfo.getInstance("US/Eastern")
- utc = ICUtzinfo.getInstance("UTC")
</del></span></pre>
</div>
</div>
</body>
</html>
|
Mon, 26 May, 09:29 |
| ia |
plied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-import peak.events.trellis as trellis
-import peak.events.activity as activity
-import peak.context as context
-
-from calendar import timegm
-from datetime import datetime
-from PyICU import ICUtzinfo
-
-def getNow(tz=None):
- """
- Return the current datetime, or the timemachine's pretend time.
-
- The timezone is set to ICUtzinfo.default if tz is None, otherwise
- timezone is set to tz.
-
- """
- if tz is None:
- tz = TimeZone.default
- return datetime.fromtimestamp(activity.Time._now, tz)
-
-def setNow(dt):
- if dt is not None and dt.tzinfo is None:
- dt = dt.replace(tzinfo=ICUtzinfo.default)
-
- timetuple = dt.astimezone(TimeZone.utc).timetuple()
-
- # this ignores calendar.timegm (or time.mktime) range limits and
- # MAXYEAR/MINYEAR, since a now timestamp really shouldn't be outside those
- # ranges
- new_timestamp = timegm(timetuple)
-
- activity.Time.auto_update = False
- activity.Time.advance(new_timestamp - activity.Time._now)
-
-def resetNow():
- activity.Time.auto_update = True
- activity.Time.tick()
-
-def nowTimestamp():
- """The number of seconds betwen the UTC epoch and now."""
- return activity.Time._now
-
-class TimeZone(trellis.Component, context.Service):
-
- default = trellis.attr(ICUtzinfo.default)
-
- @trellis.perform
- def save_default(self):
- ICUtzinfo.setDefault(self.default)
-
- class _FloatingTZInfo(ICUtzinfo):
- def __init__(self): pass
-
- def utcoffset(self, dt):
- return TimeZone.default.utcoffset(dt)
-
- def dst(self, dt):
- return TimeZone.default.dst(dt)
-
- def __repr__(self):
- return "FloatingTZ(%r)" % (TimeZone.default,)
-
- floating = _FloatingTZInfo()
-
- def __getitem__(self, key):
- result = ICUtzinfo.getInstance(key)
- if result.tzid == 'GMT' and key != 'GMT':
- return None
- else:
- return result
-
-
- ### Helper constants
- pacific = ICUtzinfo.getInstance("US/Pacific")
- eastern = ICUtzinfo.getInstance("US/Eastern")
- utc = ICUtzinfo.getInstance("UTC")
</del></span></pre>
</div>
</div>
</body>
</html>
|
Mon, 26 May, 09:29 |
| ia |
plied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-import peak.events.trellis as trellis
-import peak.events.activity as activity
-import peak.context as context
-
-from calendar import timegm
-from datetime import datetime
-from PyICU import ICUtzinfo
-
-def getNow(tz=None):
- """
- Return the current datetime, or the timemachine's pretend time.
-
- The timezone is set to ICUtzinfo.default if tz is None, otherwise
- timezone is set to tz.
-
- """
- if tz is None:
- tz = TimeZone.default
- return datetime.fromtimestamp(activity.Time._now, tz)
-
-def setNow(dt):
- if dt is not None and dt.tzinfo is None:
- dt = dt.replace(tzinfo=ICUtzinfo.default)
-
- timetuple = dt.astimezone(TimeZone.utc).timetuple()
-
- # this ignores calendar.timegm (or time.mktime) range limits and
- # MAXYEAR/MINYEAR, since a now timestamp really shouldn't be outside those
- # ranges
- new_timestamp = timegm(timetuple)
-
- activity.Time.auto_update = False
- activity.Time.advance(new_timestamp - activity.Time._now)
-
-def resetNow():
- activity.Time.auto_update = True
- activity.Time.tick()
-
-def nowTimestamp():
- """The number of seconds betwen the UTC epoch and now."""
- return activity.Time._now
-
-class TimeZone(trellis.Component, context.Service):
-
- default = trellis.attr(ICUtzinfo.default)
-
- @trellis.perform
- def save_default(self):
- ICUtzinfo.setDefault(self.default)
-
- class _FloatingTZInfo(ICUtzinfo):
- def __init__(self): pass
-
- def utcoffset(self, dt):
- return TimeZone.default.utcoffset(dt)
-
- def dst(self, dt):
- return TimeZone.default.dst(dt)
-
- def __repr__(self):
- return "FloatingTZ(%r)" % (TimeZone.default,)
-
- floating = _FloatingTZInfo()
-
- def __getitem__(self, key):
- result = ICUtzinfo.getInstance(key)
- if result.tzid == 'GMT' and key != 'GMT':
- return None
- else:
- return result
-
-
- ### Helper constants
- pacific = ICUtzinfo.getInstance("US/Pacific")
- eastern = ICUtzinfo.getInstance("US/Eastern")
- utc = ICUtzinfo.getInstance("UTC")
</del></span></pre>
</div>
</div>
</body>
</html>
|
Mon, 26 May, 09:29 |
| ia |
plied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-import peak.events.trellis as trellis
-import peak.events.activity as activity
-import peak.context as context
-
-from calendar import timegm
-from datetime import datetime
-from PyICU import ICUtzinfo
-
-def getNow(tz=None):
- """
- Return the current datetime, or the timemachine's pretend time.
-
- The timezone is set to ICUtzinfo.default if tz is None, otherwise
- timezone is set to tz.
-
- """
- if tz is None:
- tz = TimeZone.default
- return datetime.fromtimestamp(activity.Time._now, tz)
-
-def setNow(dt):
- if dt is not None and dt.tzinfo is None:
- dt = dt.replace(tzinfo=ICUtzinfo.default)
-
- timetuple = dt.astimezone(TimeZone.utc).timetuple()
-
- # this ignores calendar.timegm (or time.mktime) range limits and
- # MAXYEAR/MINYEAR, since a now timestamp really shouldn't be outside those
- # ranges
- new_timestamp = timegm(timetuple)
-
- activity.Time.auto_update = False
- activity.Time.advance(new_timestamp - activity.Time._now)
-
-def resetNow():
- activity.Time.auto_update = True
- activity.Time.tick()
-
-def nowTimestamp():
- """The number of seconds betwen the UTC epoch and now."""
- return activity.Time._now
-
-class TimeZone(trellis.Component, context.Service):
-
- default = trellis.attr(ICUtzinfo.default)
-
- @trellis.perform
- def save_default(self):
- ICUtzinfo.setDefault(self.default)
-
- class _FloatingTZInfo(ICUtzinfo):
- def __init__(self): pass
-
- def utcoffset(self, dt):
- return TimeZone.default.utcoffset(dt)
-
- def dst(self, dt):
- return TimeZone.default.dst(dt)
-
- def __repr__(self):
- return "FloatingTZ(%r)" % (TimeZone.default,)
-
- floating = _FloatingTZInfo()
-
- def __getitem__(self, key):
- result = ICUtzinfo.getInstance(key)
- if result.tzid == 'GMT' and key != 'GMT':
- return None
- else:
- return result
-
-
- ### Helper constants
- pacific = ICUtzinfo.getInstance("US/Pacific")
- eastern = ICUtzinfo.getInstance("US/Eastern")
- utc = ICUtzinfo.getInstance("UTC")
</del></span></pre>
</div>
</div>
</body>
</html>
|
Mon, 26 May, 09:29 |
| ia |
plied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-import peak.events.trellis as trellis
-import peak.events.activity as activity
-import peak.context as context
-
-from calendar import timegm
-from datetime import datetime
-from PyICU import ICUtzinfo
-
-def getNow(tz=None):
- """
- Return the current datetime, or the timemachine's pretend time.
-
- The timezone is set to ICUtzinfo.default if tz is None, otherwise
- timezone is set to tz.
-
- """
- if tz is None:
- tz = TimeZone.default
- return datetime.fromtimestamp(activity.Time._now, tz)
-
-def setNow(dt):
- if dt is not None and dt.tzinfo is None:
- dt = dt.replace(tzinfo=ICUtzinfo.default)
-
- timetuple = dt.astimezone(TimeZone.utc).timetuple()
-
- # this ignores calendar.timegm (or time.mktime) range limits and
- # MAXYEAR/MINYEAR, since a now timestamp really shouldn't be outside those
- # ranges
- new_timestamp = timegm(timetuple)
-
- activity.Time.auto_update = False
- activity.Time.advance(new_timestamp - activity.Time._now)
-
-def resetNow():
- activity.Time.auto_update = True
- activity.Time.tick()
-
-def nowTimestamp():
- """The number of seconds betwen the UTC epoch and now."""
- return activity.Time._now
-
-class TimeZone(trellis.Component, context.Service):
-
- default = trellis.attr(ICUtzinfo.default)
-
- @trellis.perform
- def save_default(self):
- ICUtzinfo.setDefault(self.default)
-
- class _FloatingTZInfo(ICUtzinfo):
- def __init__(self): pass
-
- def utcoffset(self, dt):
- return TimeZone.default.utcoffset(dt)
-
- def dst(self, dt):
- return TimeZone.default.dst(dt)
-
- def __repr__(self):
- return "FloatingTZ(%r)" % (TimeZone.default,)
-
- floating = _FloatingTZInfo()
-
- def __getitem__(self, key):
- result = ICUtzinfo.getInstance(key)
- if result.tzid == 'GMT' and key != 'GMT':
- return None
- else:
- return result
-
-
- ### Helper constants
- pacific = ICUtzinfo.getInstance("US/Pacific")
- eastern = ICUtzinfo.getInstance("US/Eastern")
- utc = ICUtzinfo.getInstance("UTC")
</del></span></pre>
</div>
</div>
</body>
</html>
|
Mon, 26 May, 09:29 |
| ia |
plied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-import peak.events.trellis as trellis
-import peak.events.activity as activity
-import peak.context as context
-
-from calendar import timegm
-from datetime import datetime
-from PyICU import ICUtzinfo
-
-def getNow(tz=None):
- """
- Return the current datetime, or the timemachine's pretend time.
-
- The timezone is set to ICUtzinfo.default if tz is None, otherwise
- timezone is set to tz.
-
- """
- if tz is None:
- tz = TimeZone.default
- return datetime.fromtimestamp(activity.Time._now, tz)
-
-def setNow(dt):
- if dt is not None and dt.tzinfo is None:
- dt = dt.replace(tzinfo=ICUtzinfo.default)
-
- timetuple = dt.astimezone(TimeZone.utc).timetuple()
-
- # this ignores calendar.timegm (or time.mktime) range limits and
- # MAXYEAR/MINYEAR, since a now timestamp really shouldn't be outside those
- # ranges
- new_timestamp = timegm(timetuple)
-
- activity.Time.auto_update = False
- activity.Time.advance(new_timestamp - activity.Time._now)
-
-def resetNow():
- activity.Time.auto_update = True
- activity.Time.tick()
-
-def nowTimestamp():
- """The number of seconds betwen the UTC epoch and now."""
- return activity.Time._now
-
-class TimeZone(trellis.Component, context.Service):
-
- default = trellis.attr(ICUtzinfo.default)
-
- @trellis.perform
- def save_default(self):
- ICUtzinfo.setDefault(self.default)
-
- class _FloatingTZInfo(ICUtzinfo):
- def __init__(self): pass
-
- def utcoffset(self, dt):
- return TimeZone.default.utcoffset(dt)
-
- def dst(self, dt):
- return TimeZone.default.dst(dt)
-
- def __repr__(self):
- return "FloatingTZ(%r)" % (TimeZone.default,)
-
- floating = _FloatingTZInfo()
-
- def __getitem__(self, key):
- result = ICUtzinfo.getInstance(key)
- if result.tzid == 'GMT' and key != 'GMT':
- return None
- else:
- return result
-
-
- ### Helper constants
- pacific = ICUtzinfo.getInstance("US/Pacific")
- eastern = ICUtzinfo.getInstance("US/Eastern")
- utc = ICUtzinfo.getInstance("UTC")
</del></span></pre>
</div>
</div>
</body>
</html>
|
Mon, 26 May, 09:29 |
| ia |
plied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-import peak.events.trellis as trellis
-import peak.events.activity as activity
-import peak.context as context
-
-from calendar import timegm
-from datetime import datetime
-from PyICU import ICUtzinfo
-
-def getNow(tz=None):
- """
- Return the current datetime, or the timemachine's pretend time.
-
- The timezone is set to ICUtzinfo.default if tz is None, otherwise
- timezone is set to tz.
-
- """
- if tz is None:
- tz = TimeZone.default
- return datetime.fromtimestamp(activity.Time._now, tz)
-
-def setNow(dt):
- if dt is not None and dt.tzinfo is None:
- dt = dt.replace(tzinfo=ICUtzinfo.default)
-
- timetuple = dt.astimezone(TimeZone.utc).timetuple()
-
- # this ignores calendar.timegm (or time.mktime) range limits and
- # MAXYEAR/MINYEAR, since a now timestamp really shouldn't be outside those
- # ranges
- new_timestamp = timegm(timetuple)
-
- activity.Time.auto_update = False
- activity.Time.advance(new_timestamp - activity.Time._now)
-
-def resetNow():
- activity.Time.auto_update = True
- activity.Time.tick()
-
-def nowTimestamp():
- """The number of seconds betwen the UTC epoch and now."""
- return activity.Time._now
-
-class TimeZone(trellis.Component, context.Service):
-
- default = trellis.attr(ICUtzinfo.default)
-
- @trellis.perform
- def save_default(self):
- ICUtzinfo.setDefault(self.default)
-
- class _FloatingTZInfo(ICUtzinfo):
- def __init__(self): pass
-
- def utcoffset(self, dt):
- return TimeZone.default.utcoffset(dt)
-
- def dst(self, dt):
- return TimeZone.default.dst(dt)
-
- def __repr__(self):
- return "FloatingTZ(%r)" % (TimeZone.default,)
-
- floating = _FloatingTZInfo()
-
- def __getitem__(self, key):
- result = ICUtzinfo.getInstance(key)
- if result.tzid == 'GMT' and key != 'GMT':
- return None
- else:
- return result
-
-
- ### Helper constants
- pacific = ICUtzinfo.getInstance("US/Pacific")
- eastern = ICUtzinfo.getInstance("US/Eastern")
- utc = ICUtzinfo.getInstance("UTC")
</del></span></pre>
</div>
</div>
</body>
</html>
|
Mon, 26 May, 09:29 |
| ic |
nfo=ICUtzinfo.default)
-
- timetuple = dt.astimezone(TimeZone.utc).timetuple()
-
- # this ignores calendar.timegm (or time.mktime) range limits and
- # MAXYEAR/MINYEAR, since a now timestamp really shouldn't be outside those
- # ranges
- new_timestamp = timegm(timetuple)
-
- activity.Time.auto_update = False
- activity.Time.advance(new_timestamp - activity.Time._now)
-
-def resetNow():
- activity.Time.auto_update = True
- activity.Time.tick()
-
-def nowTimestamp():
- """The number of seconds betwen the UTC epoch and now."""
- return activity.Time._now
-
-class TimeZone(trellis.Component, context.Service):
-
- default = trellis.attr(ICUtzinfo.default)
-
- @trellis.perform
- def save_default(self):
- ICUtzinfo.setDefault(self.default)
-
- class _FloatingTZInfo(ICUtzinfo):
- def __init__(self): pass
-
- def utcoffset(self, dt):
- return TimeZone.default.utcoffset(dt)
-
- def dst(self, dt):
- return TimeZone.default.dst(dt)
-
- def __repr__(self):
- return "FloatingTZ(%r)" % (TimeZone.default,)
-
- floating = _FloatingTZInfo()
-
- def __getitem__(self, key):
- result = ICUtzinfo.getInstance(key)
- if result.tzid == 'GMT' and key != 'GMT':
- return None
- else:
- return result
-
-
- ### Helper constants
- pacific = ICUtzinfo.getInstance("US/Pacific")
- eastern = ICUtzinfo.getInstance("US/Eastern")
- utc = ICUtzinfo.getInstance("UTC")
</del></span></pre>
</div>
</div>
</body>
</html>
|
Sun, 07 Jun, 03:49 |
| is |
e.default.dst(dt)
-
- def __repr__(self):
- return "FloatingTZ(%r)" % (TimeZone.default,)
-
- floating = _FloatingTZInfo()
-
- def __getitem__(self, key):
- result = ICUtzinfo.getInstance(key)
- if result.tzid == 'GMT' and key != 'GMT':
- return None
- else:
- return result
-
-
- ### Helper constants
- pacific = ICUtzinfo.getInstance("US/Pacific")
- eastern = ICUtzinfo.getInstance("US/Eastern")
- utc = ICUtzinfo.getInstance("UTC")
</del></span></pre>
</div>
</div>
</body>
</html>
|
Sun, 22 Jun, 20:09 |
| is |
e.default.dst(dt)
-
- def __repr__(self):
- return "FloatingTZ(%r)" % (TimeZone.default,)
-
- floating = _FloatingTZInfo()
-
- def __getitem__(self, key):
- result = ICUtzinfo.getInstance(key)
- if result.tzid == 'GMT' and key != 'GMT':
- return None
- else:
- return result
-
-
- ### Helper constants
- pacific = ICUtzinfo.getInstance("US/Pacific")
- eastern = ICUtzinfo.getInstance("US/Eastern")
- utc = ICUtzinfo.getInstance("UTC")
</del></span></pre>
</div>
</div>
</body>
</html>
|
Sun, 22 Jun, 20:09 |
| is |
e.default.dst(dt)
-
- def __repr__(self):
- return "FloatingTZ(%r)" % (TimeZone.default,)
-
- floating = _FloatingTZInfo()
-
- def __getitem__(self, key):
- result = ICUtzinfo.getInstance(key)
- if result.tzid == 'GMT' and key != 'GMT':
- return None
- else:
- return result
-
-
- ### Helper constants
- pacific = ICUtzinfo.getInstance("US/Pacific")
- eastern = ICUtzinfo.getInstance("US/Eastern")
- utc = ICUtzinfo.getInstance("UTC")
</del></span></pre>
</div>
</div>
</body>
</html>
|
Sun, 22 Jun, 20:09 |
| is |
e.default.dst(dt)
-
- def __repr__(self):
- return "FloatingTZ(%r)" % (TimeZone.default,)
-
- floating = _FloatingTZInfo()
-
- def __getitem__(self, key):
- result = ICUtzinfo.getInstance(key)
- if result.tzid == 'GMT' and key != 'GMT':
- return None
- else:
- return result
-
-
- ### Helper constants
- pacific = ICUtzinfo.getInstance("US/Pacific")
- eastern = ICUtzinfo.getInstance("US/Eastern")
- utc = ICUtzinfo.getInstance("UTC")
</del></span></pre>
</div>
</div>
</body>
</html>
|
Sun, 22 Jun, 20:09 |
| ja...@wordzoo.com |
.default)
-
- class _FloatingTZInfo(ICUtzinfo):
- def __init__(self): pass
-
- def utcoffset(self, dt):
- return TimeZone.default.utcoffset(dt)
-
- def dst(self, dt):
- return TimeZone.default.dst(dt)
-
- def __repr__(self):
- return "FloatingTZ(%r)" % (TimeZone.default,)
-
- floating = _FloatingTZInfo()
-
- def __getitem__(self, key):
- result = ICUtzinfo.getInstance(key)
- if result.tzid == 'GMT' and key != 'GMT':
- return None
- else:
- return result
-
-
- ### Helper constants
- pacific = ICUtzinfo.getInstance("US/Pacific")
- eastern = ICUtzinfo.getInstance("US/Eastern")
- utc = ICUtzinfo.getInstance("UTC")
</del></span></pre>
</div>
</div>
</body>
</html>
|
Thu, 24 Apr, 14:24 |
| ja...@wordzoo.com |
= ICUtzinfo.getInstance("US/Pacific")
- eastern = ICUtzinfo.getInstance("US/Eastern")
- utc = ICUtzinfo.getInstance("UTC")
</del></span></pre>
</div>
</div>
</body>
</html>
|
Thu, 24 Apr, 14:24 |
| m.@osafoundation.org> |
ications Foundation
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-import peak.events.trellis as trellis
-import peak.events.activity as activity
-import peak.context as context
-
-from calendar import timegm
-from datetime import datetime
-from PyICU import ICUtzinfo
-
-def getNow(tz=None):
- """
- Return the current datetime, or the timemachine's pretend time.
-
- The timezone is set to ICUtzinfo.default if tz is None, otherwise
- timezone is set to tz.
-
- """
- if tz is None:
- tz = TimeZone.default
- return datetime.fromtimestamp(activity.Time._now, tz)
-
-def setNow(dt):
- if dt is not None and dt.tzinfo is None:
- dt = dt.replace(tzinfo=ICUtzinfo.default)
-
- timetuple = dt.astimezone(TimeZone.utc).timetuple()
-
- # this ignores calendar.timegm (or time.mktime) range limits and
- # MAXYEAR/MINYEAR, since a now timestamp really shouldn't be outside those
- # ranges
- new_timestamp = timegm(timetuple)
-
- activity.Time.auto_update = False
- activity.Time.advance(new_timestamp - activity.Time._now)
-
-def resetNow():
- activity.Time.auto_update = True
- activity.Time.tick()
-
-def nowTimestamp():
- """The number of seconds betwen the UTC epoch and now."""
- return activity.Time._now
-
-class TimeZone(trellis.Component, context.Service):
-
- default = trellis.attr(ICUtzinfo.default)
-
- @trellis.perform
- def save_default(self):
- ICUtzinfo.setDefault(self.default)
-
- class _FloatingTZInfo(ICUtzinfo):
- def __init__(self): pass
-
- def utcoffset(self, dt):
- return TimeZone.default.utcoffset(dt)
-
- def dst(self, dt):
- return TimeZone.default.dst(dt)
-
- def __repr__(self):
- return "FloatingTZ(%r)" % (TimeZone.default,)
-
- floating = _FloatingTZInfo()
-
- def __getitem__(self, key):
- result = ICUtzinfo.getInstance(key)
- if result.tzid == 'GMT' and key != 'GMT':
- return None
- else:
- return result
-
-
- ### Helper constants
- pacific = ICUtzinfo.getInstance("US/Pacific")
- eastern = ICUtzinfo.getInstance("US/Eastern")
- utc = ICUtzinfo.getInstance("UTC")
</del></span></pre>
</div>
</div>
</body>
</html>
|
Mon, 03 May, 09:42 |
| m.@osafoundation.org> |
ications Foundation
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-import peak.events.trellis as trellis
-import peak.events.activity as activity
-import peak.context as context
-
-from calendar import timegm
-from datetime import datetime
-from PyICU import ICUtzinfo
-
-def getNow(tz=None):
- """
- Return the current datetime, or the timemachine's pretend time.
-
- The timezone is set to ICUtzinfo.default if tz is None, otherwise
- timezone is set to tz.
-
- """
- if tz is None:
- tz = TimeZone.default
- return datetime.fromtimestamp(activity.Time._now, tz)
-
-def setNow(dt):
- if dt is not None and dt.tzinfo is None:
- dt = dt.replace(tzinfo=ICUtzinfo.default)
-
- timetuple = dt.astimezone(TimeZone.utc).timetuple()
-
- # this ignores calendar.timegm (or time.mktime) range limits and
- # MAXYEAR/MINYEAR, since a now timestamp really shouldn't be outside those
- # ranges
- new_timestamp = timegm(timetuple)
-
- activity.Time.auto_update = False
- activity.Time.advance(new_timestamp - activity.Time._now)
-
-def resetNow():
- activity.Time.auto_update = True
- activity.Time.tick()
-
-def nowTimestamp():
- """The number of seconds betwen the UTC epoch and now."""
- return activity.Time._now
-
-class TimeZone(trellis.Component, context.Service):
-
- default = trellis.attr(ICUtzinfo.default)
-
- @trellis.perform
- def save_default(self):
- ICUtzinfo.setDefault(self.default)
-
- class _FloatingTZInfo(ICUtzinfo):
- def __init__(self): pass
-
- def utcoffset(self, dt):
- return TimeZone.default.utcoffset(dt)
-
- def dst(self, dt):
- return TimeZone.default.dst(dt)
-
- def __repr__(self):
- return "FloatingTZ(%r)" % (TimeZone.default,)
-
- floating = _FloatingTZInfo()
-
- def __getitem__(self, key):
- result = ICUtzinfo.getInstance(key)
- if result.tzid == 'GMT' and key != 'GMT':
- return None
- else:
- return result
-
-
- ### Helper constants
- pacific = ICUtzinfo.getInstance("US/Pacific")
- eastern = ICUtzinfo.getInstance("US/Eastern")
- utc = ICUtzinfo.getInstance("UTC")
</del></span></pre>
</div>
</div>
</body>
</html>
|
Mon, 03 May, 09:42 |
| m.@osafoundation.org> |
ications Foundation
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-import peak.events.trellis as trellis
-import peak.events.activity as activity
-import peak.context as context
-
-from calendar import timegm
-from datetime import datetime
-from PyICU import ICUtzinfo
-
-def getNow(tz=None):
- """
- Return the current datetime, or the timemachine's pretend time.
-
- The timezone is set to ICUtzinfo.default if tz is None, otherwise
- timezone is set to tz.
-
- """
- if tz is None:
- tz = TimeZone.default
- return datetime.fromtimestamp(activity.Time._now, tz)
-
-def setNow(dt):
- if dt is not None and dt.tzinfo is None:
- dt = dt.replace(tzinfo=ICUtzinfo.default)
-
- timetuple = dt.astimezone(TimeZone.utc).timetuple()
-
- # this ignores calendar.timegm (or time.mktime) range limits and
- # MAXYEAR/MINYEAR, since a now timestamp really shouldn't be outside those
- # ranges
- new_timestamp = timegm(timetuple)
-
- activity.Time.auto_update = False
- activity.Time.advance(new_timestamp - activity.Time._now)
-
-def resetNow():
- activity.Time.auto_update = True
- activity.Time.tick()
-
-def nowTimestamp():
- """The number of seconds betwen the UTC epoch and now."""
- return activity.Time._now
-
-class TimeZone(trellis.Component, context.Service):
-
- default = trellis.attr(ICUtzinfo.default)
-
- @trellis.perform
- def save_default(self):
- ICUtzinfo.setDefault(self.default)
-
- class _FloatingTZInfo(ICUtzinfo):
- def __init__(self): pass
-
- def utcoffset(self, dt):
- return TimeZone.default.utcoffset(dt)
-
- def dst(self, dt):
- return TimeZone.default.dst(dt)
-
- def __repr__(self):
- return "FloatingTZ(%r)" % (TimeZone.default,)
-
- floating = _FloatingTZInfo()
-
- def __getitem__(self, key):
- result = ICUtzinfo.getInstance(key)
- if result.tzid == 'GMT' and key != 'GMT':
- return None
- else:
- return result
-
-
- ### Helper constants
- pacific = ICUtzinfo.getInstance("US/Pacific")
- eastern = ICUtzinfo.getInstance("US/Eastern")
- utc = ICUtzinfo.getInstance("UTC")
</del></span></pre>
</div>
</div>
</body>
</html>
|
Mon, 03 May, 09:42 |
| m.@osafoundation.org> |
ications Foundation
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-import peak.events.trellis as trellis
-import peak.events.activity as activity
-import peak.context as context
-
-from calendar import timegm
-from datetime import datetime
-from PyICU import ICUtzinfo
-
-def getNow(tz=None):
- """
- Return the current datetime, or the timemachine's pretend time.
-
- The timezone is set to ICUtzinfo.default if tz is None, otherwise
- timezone is set to tz.
-
- """
- if tz is None:
- tz = TimeZone.default
- return datetime.fromtimestamp(activity.Time._now, tz)
-
-def setNow(dt):
- if dt is not None and dt.tzinfo is None:
- dt = dt.replace(tzinfo=ICUtzinfo.default)
-
- timetuple = dt.astimezone(TimeZone.utc).timetuple()
-
- # this ignores calendar.timegm (or time.mktime) range limits and
- # MAXYEAR/MINYEAR, since a now timestamp really shouldn't be outside those
- # ranges
- new_timestamp = timegm(timetuple)
-
- activity.Time.auto_update = False
- activity.Time.advance(new_timestamp - activity.Time._now)
-
-def resetNow():
- activity.Time.auto_update = True
- activity.Time.tick()
-
-def nowTimestamp():
- """The number of seconds betwen the UTC epoch and now."""
- return activity.Time._now
-
-class TimeZone(trellis.Component, context.Service):
-
- default = trellis.attr(ICUtzinfo.default)
-
- @trellis.perform
- def save_default(self):
- ICUtzinfo.setDefault(self.default)
-
- class _FloatingTZInfo(ICUtzinfo):
- def __init__(self): pass
-
- def utcoffset(self, dt):
- return TimeZone.default.utcoffset(dt)
-
- def dst(self, dt):
- return TimeZone.default.dst(dt)
-
- def __repr__(self):
- return "FloatingTZ(%r)" % (TimeZone.default,)
-
- floating = _FloatingTZInfo()
-
- def __getitem__(self, key):
- result = ICUtzinfo.getInstance(key)
- if result.tzid == 'GMT' and key != 'GMT':
- return None
- else:
- return result
-
-
- ### Helper constants
- pacific = ICUtzinfo.getInstance("US/Pacific")
- eastern = ICUtzinfo.getInstance("US/Eastern")
- utc = ICUtzinfo.getInstance("UTC")
</del></span></pre>
</div>
</div>
</body>
</html>
|
Mon, 03 May, 09:42 |
| m.@osafoundation.org&g |