mailr24535 - in /trunk: lib/timing.py user_functions/sys_info.py


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by edward on July 15, 2014 - 12:36:
Author: bugman
Date: Tue Jul 15 12:36:47 2014
New Revision: 24535

URL: http://svn.gna.org/viewcvs/relax?rev=24535&view=rev
Log:
Created the time user function.

This is just a shortcut for printing out the output of the time.asctime() 
function.


Added:
    trunk/lib/timing.py
Modified:
    trunk/user_functions/sys_info.py

Added: trunk/lib/timing.py
URL: http://svn.gna.org/viewcvs/relax/trunk/lib/timing.py?rev=24535&view=auto
==============================================================================
--- trunk/lib/timing.py (added)
+++ trunk/lib/timing.py Tue Jul 15 12:36:47 2014
@@ -0,0 +1,33 @@
+###############################################################################
+#                                                                            
 #
+# Copyright (C) 2014 Edward d'Auvergne                                       
 #
+#                                                                            
 #
+# This file is part of the program relax (http://www.nmr-relax.com).         
 #
+#                                                                            
 #
+# This program is free software: you can redistribute it and/or modify       
 #
+# it under the terms of the GNU General Public License as published by       
 #
+# the Free Software Foundation, either version 3 of the License, or          
 #
+# (at your option) any later version.                                        
 #
+#                                                                            
 #
+# This program is distributed in the hope that it will be useful,            
 #
+# but WITHOUT ANY WARRANTY; without even the implied warranty of             
 #
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the              
 #
+# GNU General Public License for more details.                               
 #
+#                                                                            
 #
+# You should have received a copy of the GNU General Public License          
 #
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.      
 #
+#                                                                            
 #
+###############################################################################
+
+# Module docstring.
+"""Module for various timing purposes."""
+
+# Python module imports.
+from time import asctime
+
+
+def print_time():
+    """Print the current date and time."""
+
+    # Just print out the output from time.asctime() with spacing.
+    print("%s\n" % asctime())

Modified: trunk/user_functions/sys_info.py
URL: 
http://svn.gna.org/viewcvs/relax/trunk/user_functions/sys_info.py?rev=24535&r1=24534&r2=24535&view=diff
==============================================================================
--- trunk/user_functions/sys_info.py    (original)
+++ trunk/user_functions/sys_info.py    Tue Jul 15 12:36:47 2014
@@ -1,6 +1,6 @@
 
###############################################################################
 #                                                                            
 #
-# Copyright (C) 2011-2013 Edward d'Auvergne                                  
 #
+# Copyright (C) 2011-2014 Edward d'Auvergne                                  
 #
 #                                                                            
 #
 # This file is part of the program relax (http://www.nmr-relax.com).         
 #
 #                                                                            
 #
@@ -24,6 +24,7 @@
 
 # relax module imports.
 from info import print_sys_info
+from lib.timing import print_time
 from user_functions.data import Uf_info; uf_info = Uf_info()
 from user_functions.objects import Desc_container
 
@@ -41,3 +42,18 @@
 uf.gui_icon = "oxygen.actions.help-about"
 uf.wizard_size = (700, 400)
 uf.wizard_apply_button = False
+
+
+# The time user function.
+uf = uf_info.add_uf('time')
+uf.title = "Display the current time."
+uf.title_short = "Current time."
+uf.display = True
+# Description.
+uf.desc.append(Desc_container())
+uf.desc[-1].add_paragraph("This user function will display the current time 
which can be useful for timing long calculations by having time information 
in any saved log files.")
+uf.backend = print_time
+uf.menu_text = "&time"
+uf.gui_icon = "oxygen.actions.help-about"
+uf.wizard_size = (700, 400)
+uf.wizard_apply_button = False




Related Messages


Powered by MHonArc, Updated Tue Jul 15 12:40:02 2014