Business Shell (BUSH) Guide
Author: Ken Burtch

Home Page | Introduction | Tutorials | Reference | Packages | Hacking

Packages
4.1 Using Packages
4.2 text_io (Console I/O)
4.3 text_io (File I/O)
4.4 sound
4.5 source_info
4.6 System
4.7 numerics
4.8 strings
4.9 command_line
4.10 lock_files
4.11 cgi
4.12 calendar
4.13 units
4.14 arrays
4.15 files
4.16 db (Database)
4.17 stats
4.18 pen
4.19 mysql
4.20 os
4.21 directory_operations
| This part of the guide contains detailed descriptions of the BUSH built-in packages. ### 4.12 calendar Package The calendar package provides date and time routines for BUSH. These include determining the current date and time, determining the year, performing date arithmetic and more. GCC Ada equivalent: Ada.Calendar The calendar package defines 4 special types: calendar.year_number - an integer year number (1901..2099) calendar.month_number - an integer month number (1..12) calendar.day_number - an integer day number (1..31) calendar.day_duration - a floating point number of seconds calendar.time - a point in time year_number, month_number, day_number are subtypes in Ada, but are declared as types in AdaScript to emphasize that they represent incompatible values. Limited arithmetic: a duration can be added or subtracted from a calendar.time value. "calendar.clock - 1.0" subtracts 1 second from the current time. "calendar.clock + 2.5" adds 2.5 seconds to the current time. Comparing times: time values can be compared with >, >=, <, <=, =, /=, in, and not in. t := calendar.clock
Return the current time. Example: current_time := clock; Ada Equivalent: Ada.Calendar.Clock Parameters:
t | return value | calendar.time | required | the current time
y := calendar.year( t )
Return the year of the given time. Example: the_year := calendar.year( t ); Ada Equivalent: Ada.Calendar.Year Parameters:
y | return value | calendar.year_number | required | the year value for the time (1901..2099)
t | in | calendar.time | required | the time
m := calendar.month( t )
Return the year of the given time. Example: the_month := calendar.month( t ); Ada Equivalent: Ada.Calendar.Month Parameters:
m | return value | calendar.month_number | required | the month value for the time (1..12)
t | in | calendar.time | required | the time
d := calendar.day( t )
Return the day of the given time. Example: the_year := calendar.day( t ); Ada Equivalent: Ada.Calendar.Day Parameters:
d | return value | calendar.day_number | required | the day value for the time (1..31)
t | in | calendar.time | required | the time
y := calendar.seconds( t )
Return the seconds of the given time. Example: the_seconds := calendar.seconds( t ); Ada Equivalent: Ada.Calendar.Seconds Parameters:
y | return value | calendar.day_duration | required | the seconds of the day (floating point value)
t | in | calendar.time | required | the time
calendar.split( t, y, m, d, s )
Return the year, month, day and seconds value for the given time. Example: calendar.split( t, year, month, day, secs ); Ada Equivalent: Ada.Calendar.Split Parameters:
t | in | calendar.time | required | the time
y | out | calendar.year_number | required | the year value for the time (1901..2099)
m | out | calendar.month_number | required | the month value for the time (1..12)
d | out | calendar.day_number | required | the day value for the time (1..31)
s | out | calendar.day_duration | required | the seconds of the day (floating point value)
t := calendar.time_of( y, m, d, s )
Create a time from year, month, day and seconds values. Example: the_time := calendar.time_of( 2002, 3, 15, 125.6 ); Ada Equivalent: Ada.Calendar.Time_Of Parameters:
t | return value | calendar.time | required | the time
y | in | calendar.year_number | required | the year value for the time (1901..2099)
m | in | calendar.month_number | required | the month value for the time (1..12)
d | in | calendar.day_number | required | the day value for the time (1..31)
s | in | calendar.day_duration | required | the seconds of the day (floating point value)
    => current_time : calendar.time := calendar.clock
    => ? calendar.year( current_time )
     2002
    => calendar.seconds( current_time )
     8.19477557630540E+04
    => return
Back to Top