public function add_external_service($service) {
        global $DB;
        $service->timecreated = time();
        $serviceid = $DB->insert_record('external_services', $service);
        return $serviceid;
    }
public function add_external_service($service) {
        global $DB;
        $service->timecreated = time();
        $serviceid = $DB->insert_record('external_services', $service);
        return $serviceid;
    }
public function add_external_service ( $ service ) { global $ DB ; $ service -> timecreated = time ( ) ; $ serviceid = $ DB -> insert_record ( 'external_services' , $ service ) ; return $ serviceid ; }
Add a service
It generates the timecreated field automatically.

@param stdClass $service
@return serviceid integer
Add a service It generates the timecreated field automatically .