Node.js - "RangeError: Maximum call stack size exceeded" error on new Date()

I'm creating a Node.js module to enhance the basic console output (I know there are 100+ node modules that do that, my only purpose is to practice node).

I would like to display the time with the console message. Here is the module code:

getTime = function(){
    var date = new Date()
    return date.getHours() + ':' + date.getMinutes() + ':' + date.getSeconds()
}

module.exports.log = function(text){
    console.log(getTime() + ' - ' + text)
}

So I can be able to use my module:

myConsole = require('./myconsole.js')
myConsole.log('Hello from my own console module')

It works well for few tests, but multiple calls (in short time) of myConsole result the following error message from node:

    var date = new Date()
               ^
RangeError: Maximum call stack size exceeded

Any idea how to avoid that? Do I have to destroy the date instance? (I tried to use delete date but it doesn't work)

Thanks.

The RangeError doesn't occur when I test with your code. I don't think it can cause call stack to overflow. Maximum call stack size exceeded error is often caused by a call loop in a program. I guess you need to check the call flow of your program to find out what caused the error.