mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-11 18:16:24 +05:00
added copyright addergit st
This commit is contained in:
17
copyright_header.txt
Normal file
17
copyright_header.txt
Normal file
@@ -0,0 +1,17 @@
|
||||
/*
|
||||
Rating system designed to be used in VoIP Carriers World
|
||||
Copyright (C) 2012 Radu Ioan Fericean
|
||||
|
||||
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/>
|
||||
*/
|
||||
24
header.sh
Executable file
24
header.sh
Executable file
@@ -0,0 +1,24 @@
|
||||
# check for arguments
|
||||
if [ $# -ne 1 ]
|
||||
then
|
||||
echo "Error in $0 - Invalid Argument Count"
|
||||
echo "Syntax: $0 input_file - copyright header file"
|
||||
exit
|
||||
fi
|
||||
|
||||
# check for header file
|
||||
infile=$1
|
||||
if [ ! -f $infile ]
|
||||
then
|
||||
echo "Input file [$infile] not found - Aborting"
|
||||
exit
|
||||
fi
|
||||
|
||||
# inject header
|
||||
for i in *.go
|
||||
do
|
||||
if ! grep -q Copyright $i
|
||||
then
|
||||
cat $infile $i >$i.new && mv $i.new $i
|
||||
fi
|
||||
done
|
||||
@@ -72,6 +72,7 @@ func (ap *ActivationPeriod) restore(input string) {
|
||||
elements := strings.Split(input, ";")
|
||||
unixNano, _ := strconv.ParseInt(elements[0], 10, 64)
|
||||
ap.ActivationTime = time.Unix(0, unixNano).In(time.UTC)
|
||||
ap.Intervals = make([]*Interval, 0)
|
||||
for _, is := range elements[1 : len(elements)-1] {
|
||||
i := &Interval{}
|
||||
ise := strings.Split(is, "|")
|
||||
|
||||
@@ -74,9 +74,30 @@ func TestApStoreRestore(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
/**************************** Benchmarks *************************************/
|
||||
|
||||
func BenchmarkActivationPeriodRestore(b *testing.B) {
|
||||
ap := ActivationPeriod{}
|
||||
for i := 0; i < b.N; i++ {
|
||||
ap.restore("1328106601;2|1|3,4|14:30:00|15:00:00|0|0|0|0;")
|
||||
}
|
||||
}
|
||||
|
||||
func BenchmarkActivationPeriodStoreRestore(b *testing.B) {
|
||||
b.StopTimer()
|
||||
d := time.Date(2012, time.February, 1, 14, 30, 1, 0, time.UTC)
|
||||
i := &Interval{Month: time.February,
|
||||
MonthDay: 1,
|
||||
WeekDays: []time.Weekday{time.Wednesday, time.Thursday},
|
||||
StartTime: "14:30:00",
|
||||
EndTime: "15:00:00"}
|
||||
ap := &ActivationPeriod{ActivationTime: d}
|
||||
ap.AddInterval(i)
|
||||
|
||||
ap1 := ActivationPeriod{}
|
||||
b.StartTimer()
|
||||
for i := 0; i < b.N; i++ {
|
||||
result := ap.store()
|
||||
ap1.restore(result)
|
||||
}
|
||||
}
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user