Timetable Generator API

An API exposing the functionality of Timetable Generator


Timetable Generator (desktop version, web version) is very popular among U of T students, and over the years I've had many requests for new features, extensions, and support for other faculties/campuses or even other universities, as well as requests for a web version of Timetable Generator. While I plan to work on some of these things, I cannot possibly work on all of them, so I decided to make an API that exposes the functionality of Timetable Generator, and allows other people to build software based on this functionality.

In its current state, the API functionality is specific to the University of Toronto (more specifically, to the supported faculties within the University of Toronto, which are the Faculty of Arts and Science and the Faculty of Applied Science and engineering at the St. George campus), so the API is mainly useful for building other front-ends for the existing functionality.

Over time, however, I plan to expand the API and make it more generic, so it can support any university, not just the University of Toronto, and people can use it to build timetable generation/optimization software at any university.

As of November 2012, the Timetable Generator API is open source.

I have also released a related library called libtg-ui which contains utilities for writing UIs on top of the Timetable Generator API. The Timetable Generator API together with libtg-ui currently power the desktop and web versions of Timetable Generator.

Skip ahead to Features, Documentation, FAQ, Version History, or Old Versions.


The Timetable Generator API takes the form of a C++ software library.

Get it here:

(For previous releases, I provided pre-built binary distributions as well, but I found that using them was quite error-prone. The chances of an application using the library successfully linking against the pre-built binary, and the resulting executable running correctly, were quite small, as a number of things such as compiler and library versions had to match. As a result, I discontinued distributing binary releases. Please build the library from source as instructed in the README.txt file in the source distribution.)

Don't forget to also check out libtg-ui, a library of utilities for writing UIs on top of the Timetable Generator API.


Timetable Generator is built on top the Timetable Generator API, so the API has all the features that Timetable Generator has (other than UI-specific functionality, of course).

Over time, it is possible that the API will acquire features that the desktop version of Timetable Generator does not have; if that happens, I will document those features here.


Detailed, fully cross-referenced documentation for the Timetable Generator API can be found here.


What exactly is an API?
API stands for Application Programming Interface. It refers to the interface provided by a software component that allows other software components to interact with/use it. In the case of the Timetable Generator API, the software component (to which the API is an interface) is a software library that exposes the functionality of Timetable Generator.

Is the Timetable Generator API free/open-source software?
Yes, it is! It is available under the GNU Lesser General Public License (LGPL), version 3 or later, with an exception that allows static linking without having to distribute the resulting program under the LGPL. For details, please see the LICENSE.txt file in the source distribution.

What are the prerequisites for using the API?
To use the binary distribution of the API, you need to have version 4.7 or later of the GCC compiler. Support for other compilers may be added in the future; however, please note that GCC 4.7 should be freely available on all platforms, so there should be no reason why you couldn't use it. If for some reason you are unable to use it, and as a result are unable to use the API, please let me know.

To build the API from source, in addition to GCC 4.7 you need some prerequisite libraries such as Boost. For details, see the README file of the source distribution.

Since this is a C++ library, does my program have to be written in C++ to use it?
To use the API directly, your program needs to be written in C++. However, it is possible to use the API indirectly from a program written in a different language. There are two approaches for doing this.

The first approach is to wrap the API into an interface written in the other language. Such an interface is called a binding. There are currently no bindings to the Timetable Generator API for any language other than C++, and I have no immediate plans for writing any. However, I encourage people who need a binding for a particular language to write one and contribute it back to the project, so that others can use it as well. If you'd like to write a binding but don't know how, here are some links to get you started: If you have written a binding, and would like to share it with others, please let me know and I will link to it from here.

The second approach is to write a wrapper program in C++ which can be invoked from the program written in the other language, receives inputs for the API functions from the other program, calls the API functions, and communicates back the results to the other program. The communication between the C++ program and the other program can take various forms, such as files or sockets.

The first approach (bindings) is generally easier, and I would recommend it over the second approach. However, bindings have some limitations, and in some cases the second approach may be necessary.

There is no binary distribution of the API available for my OS/architecture/compiler combination. What can I do?
The Timetable Generator API is now open-source, so you can simply build the library from source. If you are having trouble building the library from source, feel free to contact me.

What is 'libtg'?
'libtg' is the name of the static library that contains the implementations of the API functions. If you're wondering about the name, it is Unix convention to prefix libraries with 'lib', and 'tg' stands for Timetable Generator. I also use the name 'libtg' for the entire package (API headers + implementation).

Version History

Old Versions

Version Release Date Source Release Binary Release
Linux Windows
x86 x64 x86
Latest (0.6.5) April 6, 2017 libtg-0.6.5-src.zip Discontinued. Please build the library from source.
0.6.4 June 4, 2014 See the source code repository libtg-0.6.4-linux-x86-gcc.zip libtg-0.6.4-linux-x64-gcc.zip libtg-0.6.4-win-x86-mingw.zip
0.6.3 May 20, 2014 libtg-0.6.3-linux-x86-gcc.zip libtg-0.6.3-linux-x64-gcc.zip libtg-0.6.3-win-x86-mingw.zip
0.6.2 September 16, 2013 libtg-0.6.2-linux-x86-gcc.zip libtg-0.6.2-linux-x64-gcc.zip libtg-0.6.2-win-x86-mingw.zip
0.6.1 April 3, 2013 libtg-0.6.1-linux-x86-gcc.zip libtg-0.6.1-linux-x64-gcc.zip libtg-0.6.1-win-x86-mingw.zip
0.6.0 November 9, 2012 libtg-0.6.0-linux-x86-gcc.zip libtg-0.6.0-linux-x64-gcc.zip libtg-0.6.0-win-x86-mingw.zip
0.5.4 April 26, 2012 libtg-0.5.4-linux-x86-gcc.tgz libtg-0.5.4-linux-x64-gcc.tgz libtg-0.5.4-win-x86-mingw.zip
0.5.3 March 17, 2012 libtg-0.5.3-linux-x86-gcc.tgz libtg-0.5.3-linux-x64-gcc.tgz libtg-0.5.3-win-x86-mingw.zip

Contact Info

Your suggestions (and feature requests, bug reports, etc.) are welcome. Please send them to