Author: eur.van.andel
Date: Thu Oct 30 01:48:25 2008
New Revision: 501
Added:
trunk/tools/timeset.py (contents, props changed)
trunk/unvalidated/sample/by_device/16f876a/now.jal
Log:
added now.jal, although it should be generated by timeset.py
put timeset.py in tools, is this the right spot?
Added: trunk/tools/timeset.py
==============================================================================
--- (empty file)
+++ trunk/tools/timeset.py Thu Oct 30 01:48:25 2008
@@ -0,0 +1,56 @@
+#!/usr/bin/python
+#
+# Title: timeset, writes now.jal which contains the right date and furture
time
+# Author: Eur van Andel, [EMAIL PROTECTED] Copyright (c) 2008, all rights
reserved.
+# Adapted-by:
+# Compiler:
+#
+# This file is part of jallib (http://jallib.googlecode.com)
+# Released under the BSD license
(http://www.opensource.org/licenses/bsd-license.php)
+#
+# Sources:
+#
+# Description: this script writes the system time in a jal file that can
be included in a RTC setting
+# to have a proper date and time just after programming
+
+from time import strftime, localtime, sleep
+
+
+if __name__ == "__main__":
+
+ jal = open('now.jal','w')
+
+ jal.write('-- \n')
+ jal.write('-- file: now.jal, Python generated\n')
+ jal.write('-- author: Eur van Andel, [EMAIL PROTECTED]')
+ jal.write('-- purpose: to set RTC in JAL, time is set to now + 1
minute\n')
+ jal.write('-- \n')
+ jal.write('\n')
+
+ date = localtime()[2]
+ month = localtime()[1]
+ year = localtime()[0]
+
+ hours = localtime()[3]
+ minutes = localtime()[4]
+ seconds = localtime()[5]
+
+ minutes = minutes + 1
+ if minutes > 59 :
+ minutes = (minutes - 60)
+ hours = hours + 1 # don't run this at 23:59, OK?
+
+ jal.write('date = %2d \n' % date)
+ jal.write('month = %2d \n' % month)
+ jal.write('year = %2d \n' % year)
+ jal.write('hours = %2d \n' % hours)
+ jal.write('minutes = %2d \n' % minutes)
+ jal.write('seconds = %2d \n' % seconds)
+
+ print 'date is %02d-%02d-%02d' % (date, month, year) # to
see something happening
+ print 'time is %02d:%02d:%02d' % (hours, minutes, seconds)
+
+ jal.flush
+ jal.close
+
+
Added: trunk/unvalidated/sample/by_device/16f876a/now.jal
==============================================================================
--- (empty file)
+++ trunk/unvalidated/sample/by_device/16f876a/now.jal Thu Oct 30 01:48:25
2008
@@ -0,0 +1,12 @@
+--
+-- file: now.jal, Python generated
+-- author: Eur van Andel, [EMAIL PROTECTED]
+-- purpose: to set RTC in JAL, time is set to now + 1 minute
+--
+
+date = 29
+month = 10
+year = 2008
+hours = 22
+minutes = 43
+seconds = 16
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"jallib" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/jallib?hl=en
-~----------~----~----~----~------~----~------~--~---